train dataframe with content column. content column has list for each row containing different words in that list.
content
[sure, tune, …, watch, donald, trump, “,”, late, ’ , night]
[abc, xyz, “,”,late, ’, night]
Code to remove regular expressions
import re
train['content'] = train['content'].map(lambda x: re.sub(r'\W+', '', x))
Error
TypeError: expected string or bytes-like object
Expected output
content
[sure, tune, watch, donald, trump, late, night]
[abc, xyz,late, night]
Notice all the special characters like ..., “, ” and ’ are gone and we are left only with words.