checked:
Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.isin.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.iteritems.html
What I try to do is, based on a series value take different actions:
import pandas as pd
s = pd.Series([1,2,3, 4, 5, 6], name='number')
check_1 = ([1,2,3])
check_2 = ([4, 5, 6])
enter code here
different actions:
for index, value in s.items():
if s.isin([check_1]).any():
print('checked_1')
elif s.isin([check_2]).any():
print('checked_2')
else:
print ('nothing')
What I get is:
nothing --> *should be checked_1*
nothing --> *should be checked_1*
nothing --> *should be checked_1*
nothing --> *should be checked_2*
nothing --> *should be checked_2*
nothing --> *should be checked_2*