I have a Pandas data frame with a column that contains a list and a value:
([z, z, z, z, m, ., c, l, u, b, .], 0.0)
How do I split this column into two columns that I add to the data frame? The output I want: one column will contain the list, the other column will contain the value. For example:
[z, z, z, z, m, ., c, l, u, b, .]
and 0.0
I have tried str.split(...,expand=True,)
but the output is just a column of NaN
. I can't use the comma delimiter and ],
both produce one column of NaN
rather than a column of lists and a column of values.
Here's 4 rows of the column of my Pandas data frame that I'm trying to manipulate.
X['set']
1 ([z, z, z, z, m, ., c, l, u, b, .], 0.0)
2 ([z, z, z, z, g, ., c, l, u, b, .], 0.0)
3 ([z, z, z, z, cy, s, ., l, o, a, n, .], 0.0)
4 ([z, z, z, x, c, ., u, s, .], 0.0)