This question has been posted in a few forms, but for some reason, none of the solutions are working for my use case. I have a lookup number that is part of a class that I have created. I want to simply see if that number exists in a column of my dataframe. Below are the solutions I've tried :
# Where body_part.LookupNumber is a unique int and body_part.SymptomTable['BodyPartIllnessTypeId'] is a column of ints.
if body_part.LookupNumber in body_part.SymptomTable['BodyPartIllnessTypeId'].tolist():
do something
# Get this error ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
# Fair enough, so then I tried this:
if body_part.LookupNumber in body_part.SymptomTable['BodyPartIllnessTypeId'].values:
do something
# Get this error ValueError: Lengths must match to compare
Oddly enough, when I run this, it prints. In this case I've instantiated i to be a class object:
if i.LookupNumber in i.SymptomTable['BodyPartIllnessTypeId'].values:
print('worked')
Thanks for your time.