A similar question was already asked before Split a Pandas column of lists, and it dealt with splitting a single column of a nested list into multiple columns.
My case is slightly different. lets say I have a dframe
with multiple columns containing nested lists, I am seeking for a solution to split those nested lists into multiple columns.
dframe:
0 1
0 [u, 8.000000e+00, 4.47e-01] [a0, 3.384351e-03, 1.23e-03]
1 [u, 8.000000e+00, 4.47e-01] [a0, 3.384351e-03, 1.23e-03]
2 [u, 8.000000e+00, 5.53e-01] [a0, 4.897271e-03, 1.79e-03]
I tried most of the methods suggested in the post above Split a Pandas column of lists into multiple columns:
pd.DataFrame(dframe[0].to_list(), columns=['u','val', 'err'])
basically, they did not work for me as these methods seem meant to be for a single column.
What I expect is something like this:
Output:
0 1 2 3 4 5
0 u 8.000000e+00 4.47e-01 a0 3.384351e-03 1.23e-03
1 u 8.000000e+00 4.47e-01 a0 3.384351e-03 1.23e-03
2 u 8.000000e+00 5.53e-01 a0 4.897271e-03 1.79e-03
I have a hard time to solve this issue for a couple of days, I would really appreciate your kind response.