0

I have the following dataframe in which for col 'email' I am trying to validate if this is a genuine email or not and want to store result in a new column as true or false

email
abc@gmail.com
bcd@ghotmail.de
ddd@yahoo.com
ded@yahoo.in
–≤—ñ–¥—á–µ–Ω–Ω—è ‚Ññ 2971) 2017
,activity
,"null"

the desired output

email                                    valid
abc@gmail.com                            true
bcd@ghotmail.de                          true
ddd@yahoo.com                            true
ded@yahoo.in                             true
–≤—ñ–¥—á–µ–Ω–Ω—è ‚Ññ 2971).              false
,activity                                false
,"null"                                  false

I am using the following code but the problem is that it is returning everything to be true. I am using the validate_email package

from validate_email import validate_email
df['valid_email'] = df['email'].apply(validate_email)

Why this is not returning the right result here? Any other way of doing this?

Django0602
  • 797
  • 7
  • 26
  • Does this [question](https://stackoverflow.com/questions/50148708/how-do-i-best-validate-email-in-pandas-data-frame) helps you? – Eduardo Coltri Feb 03 '21 at 13:31
  • @EduardoColtri: it does but my data is a little more complex. using the solution provided in the question you suggested, I am still get true values in my data where there is not even an actual email address – Django0602 Feb 03 '21 at 13:38

0 Answers0