Here\'s some data from another question:
positive negative neutral
1 [marvel, moral, bold, destiny]
Another alternative is
In [43]: df.applymap(lambda x: x[1:-1].split(', '))
Out[43]:
positive negative neutral
1 [marvel, moral, bold, destiny] [] [view, should]
2 [beautiful] [complicated, need] []
3 [celebrate] [crippling, addiction] [big]
Note that this assumes the first and last character in each cell is [
and ]
.
It also assumes there is exactly one space after the commas.