Converting string of strings to list in dataframe

Viewed 43

I have a dataframe as following:

id|words
1|ant,bat,cat
2|mat,rat,pat

I want the words column to be as follows:

id|words
1|['ant','bat','cat']
2|['mat','rat','pat']

How could I do it? I tried with literaleval but it shows exception

1 Answers
Related