pandera.checks.Check.isin#
- classmethod Check.isin(cls, allowed_values, **kwargs)[source]#
Ensure only allowed values occur within a series.
- Parameters
allowed_values (
Iterable
) – The set of allowed values. May be any iterable.kwargs – key-word arguments passed into the Check initializer.
- Return type
- Returns
Check
object
Note
This checks whether all elements of a
pandas.Series
are part of the set of elements of allowed values. If allowed values is a string, the set of elements consists of all distinct characters of the string. Thus only single characters which occur in allowed_values at least once can meet this condition. If you want to check for substrings useCheck.str_is_substring()
.Note
In constrast with
Check.unique_values_eq()
, this check only makes sure that the values in the checked data object are within an allowable set.