import pandas as pd
from validate_email import validate_email
my_email={'email':['Ravi','abc@example.com','Alex',
'Ron.23@my_domain.com']}
df = pd.DataFrame(data=my_email)
df['valid_email'] = df['email'].apply(lambda x:validate_email(x))
print(df)
print(df[df['valid_email']]) # only valid emails ...
Output
email valid_email
0 Ravi False
1 abc@example.com True
2 Alex False
3 Ron.23@my_domain.com True
email valid_email
1 abc@example.com True
3 Ron.23@my_domain.com True
If you are getting error saying pip install validate_email
Inside Anaconda goto Environment
at your left side navigational menu Base root
Open Terminal
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.