redact_emails.py 395 B

12345678910111213
  1. import re
  2. import pandas as pd
  3. def email(df):
  4. return pd.Series(df.apply(lambda text: re.sub("\S+@\S+", r'xxx', text)))
  5. # #################################### Test
  6. # #########################################
  7. #
  8. # Texts = ["I used these two email mouafek.ayadi@esprit.tn, moufak.ayadi@oddo-bhf.com", "this is another email afek.aadi@esit.com" ]
  9. # data = pd.Series(Texts)
  10. # print(email(data))