Skip to content

IsIn(values) Source

Bases: Rule

Keep the values that belong to a list of accepted values.

Added in version 0.1.0

Parameters:

  • values (list[ScalarValue])

    The accepted values, a list of ScalarValue such as ["Paris", "Lyon"] or [1, 2], at least one and all of the same kind. The rule keeps its own copy, so changing the list afterwards does not change the rule.

Raises:

Examples:

import numdaplot as ndp

countries = ndp.Array.from_list(["FR", "US", "DE"])
countries.select(ndp.IsIn(["FR", "DE"]))
# Array(['FR', 'DE'], dtype=TEXT)