1

Here's what my dataframe pandas looks like :

                                            colA
0 [399, 358, 0, 5G, France, , 620, 200219277, 2021]

I would like to get each element and put it in a dataframe df to get this

    col1|  Col2|  col3| col4 |Col5   |col6 | col7 | Col8      | col9
    --------------------------------------------------------------------
0   399 |   358|  0   |   5G | France|     | 620  |200219277  |2021

I tried this :

df_res[['col1','col2','col3','col4','col5','col6','col7','col8','col9']] = pd.DataFrame(df_res.colA.tolist(), index= df_res.index)

but i got this error

raise ValueError('Columns must be same length as key')
ValueError: Columns must be same length as key
Sara
  • 353
  • 1
  • 3
  • 13

0 Answers0