Check if string is in a pandas dataframe

前端 未结 7 2044
北荒
北荒 2020-11-28 06:38

I would like to see if a particular string exists in a particular column within my dataframe.

I\'m getting the error

ValueError: The truth v

7条回答
  •  难免孤独
    2020-11-28 07:11

    I bumped into the same problem, I used:

    if "Mel" in a["Names"].values:
        print("Yep")
    

    But this solution may be slower since internally pandas create a list from a Series.

提交回复
热议问题