I defined a list of values that I am searching for in a column of a dataframe and want to replace all values in that df that match.
First_name
0 Jon
1 Bill
2 Bill
names = {'First_name': ['Jon','Bill', 'Bill']}
name_list = ['Bill']
df = DataFrame(names,columns=['First_name'])
df.loc[df['First_name'].apply(str) in name_list] = 'Killed'
Should result in
First_name
0 Jon
1 Killed
2 Killed
but I'm getting an error
TypeError: 'in ' requires string as left operand, not Series
Not too sure why, since I am applying (str) to the left operand