Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
s = pd.Series(['dog', 'cow', 'dog', 'cat', 'dog',
               'lion'], name='animal')
In [3]:
s.isin(['cow', 'dog'])
Out[3]:
0     True
1     True
2     True
3    False
4     True
5    False
Name: animal, dtype: bool

Passing a single string as s.isin('dog') will raise an error. Use a list of one element instead:

In [4]:
s.isin(['dog'])
Out[4]:
0     True
1    False
2     True
3    False
4     True
5    False
Name: animal, dtype: bool