Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Data Science by (17.6k points)

I have a dataframe(sample_emails) that provides a list of emails and I would like to extract only the workplace from the email. For example from the email such as [email protected], it should return only the string "uber". I tried writing the code for this but I keep getting a variety of errors.

extract_company = extract_company.find(email[ start['@', end['.']]

def extract_company(email):


The extracted value should be returned into the df extract_company

1 Answer

0 votes
by (41.4k points)

Use this below line of code with pandas.Series.str.extract:

import pandas as pd

extract_company = pd.Series(['[email protected]', '[email protected]'])


This will give you the output as: 


0    google

1    facebook

If you wish to learn Pandas visit this Pandas Tutorial.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.6k users

Browse Categories