validate_email: to Validate email

Validate Email , more on apply() here.
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
ModuleNotFoundError: No module named 'validate_email'
then you have to install validate_email module.
pip install validate_email
Inside Anaconda goto Environment at your left side navigational menu
MySQL installation from Anaconda
Middle you can see Base root
From Base root select Open Terminal
MySQL installation from Anaconda
You will reach the Anaconda terminal where you can install any package .
Installing validate_email
Pandas Pandas DataFrame
contains() to display and delete row based on Conditions
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer