If I have a frame like this
frame = pd.DataFrame({'a' : ['the cat is blue', 'the sky is green', 'the dog is black']})
and I want to check if any of those rows contain a certain word I just have to do this.
frame['b'] = frame.a.str.contains("dog") | frame.a.str.contains("cat") | frame.a.str.contains("fish")
frame['b']
outputs:
True
False
True
If I decide to make a list
mylist =['dog', 'cat', 'fish']
how would I check that the rows contain a certain word in the list?