I am wondering how can I generate a dataframe from my list of list
A=[['a','b','c'],['c','d','e'],['f','g','h']]
such that I obtain a dataframe with only 1 column and 3 rows containing the differents list ['a','b','c']
,['c','d','e']
and ['f','g','h']
respectively
CodePudding user response:
Try using:
In [40]: pd.Series(A, name='col').to_frame()
Out[40]:
col
0 [a, b, c]
1 [c, d, e]
2 [f, g, h]
CodePudding user response:
You could do this by casting A
as a value within a dict.
>>> A=[['a','b','c'],['c','d','e'],['f','g','h']]
>>> import pandas as pd
>>> pd.DataFrame({'col':A})
col
0 [a, b, c]
1 [c, d, e]
2 [f, g, h]