when using contractions.fix on the dataframe in pandas shows IndexError: string index out of range

Viewed 619

I am trying to use contractions.fix to expand the words in my dataset. But when I run the code and try to add the expanded words to a new column in the dataset, I get an error String index out of range. I tried to search everywhere possible about it but I could not find a solution.

Screenshot of the Dataset, I want to run contractions.fix on comments column

img

The screenshot of the code and the error is thrown:

This is the code I am using and it shows the error(below in the screenshot)

This is my code to run contractions.fix:

rws["expanded_words"]=rws['comments'].apply(lambda x: [contractions.fix(word) for word in x.split()])
0 Answers
Related