My question is regarding a Pandas DataFrame and a list of e-mail addresses. The simplified dataframe (called 'df') looks like this:
Name Address Email
0 Bush Apple Street
1 Volt Orange Street
2 Smith Kiwi Street
The simplified list of e-mail addresses looks like this:
list_of_emails = ['[email protected]', '[email protected]', '[email protected]']
Is it possible to loop through the dataframe, to check if a last name is (part of) a e-mail address AND then add that email address to the dataframe? The following code does not work unfortunately, because of line 2 I think:
for index, row in df.iterrows():
if row['Name'] in x for x in list_of_emails:
df['Email'][index] = x
Your help is very much appreciated!