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

后端 未结 6 2067
谎友^
谎友^ 2020-11-28 02:31

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

6条回答
  •  一向
    一向 (楼主)
    2020-11-28 02:53

    I was having trouble with the not (~) symbol as well, so here's another way from another StackOverflow thread:

    df[df["col"].str.contains('this|that')==False]
    

提交回复
热议问题