How to delete all records in Pandas Dataframe with invalid email (doesn't have name , domain, at sign)
My code looks like :
import re
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
def validate_email(email):
return re.search(regex, email)
all_data = all_data.loc[all_data['Email'].apply(validate_email)]
but I have error:
KeyError: "None of [Index([ None,\n None,\n None,\n None,\n None,\n <re.Match object; span=(0, 16), match='adam@example.com'>,\n
how do it correctly ??