I have a pandas dataframe df, which has only one column col. I want to loop values of col, and add columns to fill values by using the values of the first column col. For example, the first row is a list, which has 3 elements ['text1','text2','text3']. I want to add 3 columns, and fill values using 'text1','text2' and 'text3'.
import pandas as pd
df=pd.DataFrame({'col':[['text1','text2','text3'],['mext1','mext2'],['cext1']]})
df
col
0 [text1, text2, text3]
1 [mext1, mext2]
2 [cext1]
I want like this:
col col_1 col_2 col_3
0 [text1, text2, text3] text1 text2 text3
1 [mext1, mext2] mext1 mext2 Nan
2 [cext1] cext1 Nan Nan
Your help will be appreciated.
