traveler.core.categorical.CategoricalArray.from_values_predefined#
- classmethod CategoricalArray.from_values_predefined(values, mark, store)[source]#
Create categorical codes from values using categories in a store.
- Parameters:
values (jax.Array or Any) – Values to encode as categorical codes.
mark (str) – Name of the predefined category group, optionally prefixed with
"@".store (Any) – Store that provides the category group through
__category_validation__.
- Returns:
Encoded values using the store’s predefined categories.
- Return type:
- Raises:
KeyError – If the requested category group is absent from the store.
ValueError – If any value is not present in the predefined categories.