cudf.Series.isin#

Series.isin(values)#

Check whether values are contained in Series.

Parameters:
valuesset or list-like

The sequence of values to test. Passing in a single string will raise a TypeError. Instead, turn a single string into a list of one element.

Returns:
resultSeries

Series of booleans indicating if each element is in values.

Raises:
TypeError

If values is a string

Examples

>>> import cudf
>>> s = cudf.Series(['lama', 'cow', 'lama', 'beetle', 'lama',
...                'hippo'], name='animal')
>>> s.isin(['cow', 'lama'])
0     True
1     True
2     True
3    False
4     True
5    False
Name: animal, dtype: bool

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

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

Strings and integers are distinct and are therefore not comparable:

>>> cudf.Series([1]).isin(['1'])
0    False
dtype: bool
>>> cudf.Series([1.1]).isin(['1.1'])
0    False
dtype: bool