Two things, you need to put your code in a preformatted text section you enclose your code in 3 `'s before and after the code so it will maintain formatting. There is also a button that looks like </> that would create the space. The other thing, if it isn’t working, is it giving any error in your console? If so showing that error will help point to the issue.
i made an adjustment for indexing and got this error
ERROR [ActionAdapter-AWT-EventQueue-2] <HTML>Error executing script for event: <code><b>actionPerformed</b></code><BR>on component: <code><b>Button</b></code>.
Traceback (most recent call last):
File "<event:actionPerformed>", line 66, in <module>
IndexError: Row 0 doesn't have the same number of columns as header list.
I has extended to first line to have as many items as the most filled row and am using header = csvData.next() which should take care of that. but something is funky
To explain it, the \ is an escape character for python. By doubling it up it will treat it as a backslash which is what your looking for. A forward slash may also work as a fix.
The weird part is I use that exact same code for 3 other files. And it places all of them in the table and lets me pull from them. But for some weird reason with this file is not working. i tried a combo of slashes but no luck.
this is the last error i got
ERROR [ActionAdapter-AWT-EventQueue-2] <HTML>Error executing script for event: <code><b>actionPerformed</b></code><BR>on component: <code><b>Button</b></code>.
Traceback (most recent call last):
File "<event:actionPerformed>", line 66, in <module>
IndexError: Row 0 doesn't have the same number of columns as header list.
Line 66 is a different error than the original one. I’m assuming it lines up with your system.dataset.toDataSet(). If your headers and your rows under it don’t match it will do that. What I would do is add a print for your header and a print for row in your loop and look at the data returned to make sure it is processing it how you think.
Also where it lists row 0, I’m wondering do you have an empty row between your header and your data in your CSV. I’d look specifically at that row to start but it has to line up all the way through or it will throw that error. You could also potentially have an empty column that has a header but doesn’t have any data in it at for the last column.
The console made it through row 0 and 1 printing then threw the error. But I did notice know the header did not cover all the columns. so I extended it . but not every row has data in it for that column. Do I need data in every row and column? Could I program a fail safe. if row col null insert NA or something?
Each row of data must have the same number of elements as the list of headers (column names). You can supply a python None for null, but you may have flaky behavior if any nulls are in the first row. The toDataSet() function determines column data types from the first row, and will use String by default. If you cannot guarantee a non-null first row, you should use the underlying platform DatasetBuilder tool, so you can explicitly set the column data types. There are numerous examples on this forum.
Traceback (most recent call last):
File "<event:actionPerformed>", line 68, in <module>
IndexError: Row 0 doesn't have the same number of columns as header list.