EDIT MADE:
I have the 'Activity' column filled with strings and I want to derive the values in the 'Activity_2' column using an if statement.
So Activity_2 shows the desired result. Essentially I want to call out what type of activity is occurring.
I tried to do this using my code below but it won't run (please see screen shot below for error). Any help is greatly appreciated!
for i in df2['Activity']:
if i contains 'email':
df2['Activity_2'] = 'email'
elif i contains 'conference'
df2['Activity_2'] = 'conference'
elif i contains 'call'
df2['Activity_2'] = 'call'
else:
df2['Activity_2'] = 'task'
Error: if i contains 'email':
^
SyntaxError: invalid syntax
if i == 'email': df2['Activity_2'] = 'email'
– Grummet