I try to use any() to check if the column contains any string from the list and make a new column with the corresponding results
df_data = pd.DataFrame({'A':[2,1,3], 'animals': ['cat, frog', 'kitten, fish', 'frog2, fish']})
cats = ['kitten', 'cat']
df_data['cats'] = df_data.apply(lambda row: True if any(item in cats for item in row['animals']) else False, axis = 1)
I got these results, and I don't understand why it is False for the first two rows :
A animals cats
0 2 cat, frog False
1 1 kitten, fish False
2 3 frog2, fish False
I expect to get False for the last row only