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
ScalarValuesuch 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:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
EmptyValuesErrorWhen
valuesis empty.
Examples:
import numdaplot as ndp
countries = ndp.Array.from_list(["FR", "US", "DE"])
countries.select(ndp.IsIn(["FR", "DE"]))
# Array(['FR', 'DE'], dtype=TEXT)