w3resource

Pandas Series: isin() function

Find values contained in Pandas series

The isin() function is used to check whether values are contained in Series.

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

Syntax:

Series.isin(self, values)
Pandas Series isin image

Parameters:

Name Description Type/Default Value Required / Optional
values 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.
New in version 0.18.1: Support for values as a set.
set or list-like Required

Returns: Series
Series of booleans indicating if each element is in values.

Raises: TypeError
If values is a string

Example:


Download the above Notebook from here.



Inviting useful, relevant, well-written and unique guest posts