I'm trying to remove all the punctuation from a dataframe, except the characters '<' and '>'
I tried:
def non_punct(df):
df['C'] = df['C'].str.replace('[^\w\s]' | ~(<) | ~(>),' ')
return df
Output:
File "<ipython-input-292-ac8369672f62>", line 3
df['Description'] = df['Description'].str.replace('[^\w\s]' | ~(<) | ~(>),' ')
^
SyntaxError: invalid syntax
My dataframe:
A B C
French house Phone. <phone_numbers>
English house email - <adresse_mail>
French apartment my name is Liam
French house Hello George!
English apartment Ethan, my phone is <phone_numbers>
Good output:
A B C
French house Phone <phone_numbers>
English house email <adresse_mail>
French apartment my name is Liam
French house Hello George
English apartment Ethan my phone is <phone_numbers>