Reputation: 63
I want to delete "\n" and "[" characters from jobDescription column in dataframe.
I try this code. But it s not working
data['jobDescription'] = data['jobDescription'].str.replace(r'\n',' ', regex=True)
you can see the df in the picture below;
how do i solve this problem? Thanks.
Upvotes: 0
Views: 173
Reputation: 4642
You can make use of python regular expression.
import re
data.jobDescription.apply(lambda x : ''.join(re.findall("[a-zA-Z0-9 ]",text)))
The regex pattern will only allow alphabets and numbers, if you want to include symbols, you can add in the pattern to achieve that.
Upvotes: 1