pandas.Series.isin

Series.isin(values)

Return a boolean Series showing whether each element in the Series is exactly contained in the passed sequence of values.

Parameters:

values : list-like

The sequence of values to test. Passing in a single string will raise a TypeError:

from pandas import Series
s = Series(list('abc'))
s.isin('a')

Instead, turn a single string into a list of one element:

from pandas import Series
s = Series(list('abc'))
s.isin(['a'])
Returns:

isin : Series (bool dtype)

Raises:

TypeError :

  • If values is a string