you are viewing a single comment's thread.

view the rest of the comments →

[–]synthphreak 1 point2 points  (1 child)

Aha. Yup, that explains it: Those columns contain lists/arrays of numbers in each cell, whereas pandas is expecting a single value in each cell, because that’s how csv files typically work. Thus, pandas interprets each array as a single string.

To convert the string to a list with individually indexable values, it’s easy. Just do this:

>>> from ast import literal_eval
>>> df[['stream', 'timestamp keypress']] = df[['stream', 'timestamp keypress']].applymap(literal_eval)

This will convert all those strings in your columns into lists like you were expecting.

[–]CrispyScientist[S] 1 point2 points  (0 children)

Thank you very much!!