I have a CSV file with no headers and where each row contains multiple lists of floats.
[(40.65, 20.30, 120.92, 86.12, 99.33), (10.35, 90.10, 10.52, 1.12, 59.3), (10.65, 62.10, 12.12, 96.23, 19.3)]
[(96.37, 67.13, 312.62, 87.11, 87.18), (90.94, 41.04, 63.01, 9.10, 30.3), (11.98, 99.01, 41.30, 16.04, 10.4)]
[(11.88, 12.98, 182.22, 13.84, 81.09), (50.35, 10.10, 10.52, 8.12, 91.3), (88.51, 21.66, 81.13, 36.13, 97.3)]
- For each row, how can I access the list objects ?
Let’s say I want to retrieve the first list of floats on the second row. What method do I need to call to get (96.37, 67.13, 312.62, 87.11, 87.18)
as an output ?
table.getRow(1)
is unsubscriptable and table.getRow(1).getFloat(0)
will return the first value, not the first list object.
- How can I isolate the first and last value of each list from the brackets ?
Calling table.getRow(1).getFloat(0)
will actually return a NaN
in this case because table.getRow(1).getString(0)
is returning [(96.37
, not 96.37
. Same thing for the last value of each list.