Remove Punctuation
import pandas as pd
content = ['hey!','great..','nice@']
df=pd.DataFrame(content,columns={'Sms content'})
df
Sms content | |
---|---|
0 | hey! |
1 | great.. |
2 | nice@ |
import string
string.punctuation
def remove_punctuation(text):
new_text=''.join([char for char in text if char not in string.punctuation])
return new_text
df['new_sms']=df['Sms content'].apply(lambda row : remove_punctuation(row))
df
Sms content | new_sms | |
---|---|---|
0 | hey! | hey |
1 | great.. | great |
2 | nice@ | nice |