I have a pandas dataframe with one column having lists as values. for example:
a = [(1,1,[1,2]),(2,2,[2,3,4])]
In [75]: pd.DataFrame.from_records(a,columns=['a','b','c'],exclude='b')
Out[75]:
a c
0 1 [1, 2]
1 2 [2, 3, 4]
As you can see, column c actually contains a list. this is verfied by:
In [76]: _.c.ix[0]
Out[76]: [1, 2]
So here, the dataframe contains true lists, available for later analysis with all the list class functionality. But when Im saving the dataframe and then loading it again, the list becomes string:
In [72]: _.to_csv(r'D:\test.csv')
In [73]: pd.read_csv(r'D:\test.csv')
Out[73]:
Unnamed: 0 a c
0 0 1 [1, 2]
1 1 2 [2, 3, 4]
In [74]: _.c.ix[0]
Out[74]: '[1, 2]'
And I lost list functionality. Is this a bug?