pandera.backends.narwhals.builtin_checks.isin

pandera.backends.narwhals.builtin_checks.isin(col_expr, allowed_values)[source]

Ensure only allowed values occur within a series.

This checks whether all elements of a 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 use Check.str_contains().

Parameters:
  • col_expr (Expr) – Narwhals column expression to check.

  • allowed_values (Collection) – The set of allowed values. May be any iterable.

Return type:

Expr