I have a pandas data frame with a column called Job Title, and I have a list with allowed Job Titles. I want to check the Job Title column against the allowed list, and if it is not allowed, make the value blank ("").
This is the code I am using:
df_detail.loc[~df_detail["Job Title"].isin(allowed_jobs), "Job Title"] = ""
It appears to work but I am getting this warning message which I would rather not cause at all. What am I doing wrong here?
SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
Thanks!