Search for “does-not-contain” on a DataFrame in pandas

I’ve done some searching and can’t figure out how to filter a dataframe by

df["col"].str.contains(word)

however I’m wondering if there is a way to do the reverse: filter a dataframe by that set’s compliment. eg: to the effect of

!(df["col"].str.contains(word))

Can this be done through a DataFrame method?

8 Answers
8

Leave a Comment