Remove_Punctuation
import string
import pandas as pdSms_content=['hi,how are you','Iam fine','what is it?']
df=pd.DataFrame(Sms_content,columns={'sms'})
df| sms | |
|---|---|
| 0 | hi,how are you |
| 1 | Iam fine |
| 2 | what is it? |
def remove_punctuation(text):
new_text=''.join([char for char in text if char not in string.punctuation])
return new_textdf['new_sms']=df['sms'].apply(lambda row : remove_punctuation(row))
df| sms | new_sms | |
|---|---|---|
| 0 | hi,how are you | hihow are you |
| 1 | Iam fine | Iam fine |
| 2 | what is it? | what is it |