traveler.demo.work_location.CategoricalArray#

class traveler.demo.work_location.CategoricalArray(categories, codes, ordered=False, jax_check=True, mark='CAT')[source]#

Bases: object

Base class for categorical data handling.

Parameters:
  • categories (Sequence[str] | Sequence[int])

  • codes (Array | Any)

  • ordered (bool)

  • jax_check (bool)

  • mark (str)

Methods#

from_codes_predefined(codes, mark, store[, ...])

Create a CategoricalArray from predefined categories in the store.

from_pandas(x)

Create a categorical array from a pandas categorical series.

from_values(categories, values[, ordered, mark])

Create a CategoricalArray from categories and values.

from_values_predefined(values, mark, store)

Create categorical codes from values using categories in a store.

take(*args, **kwargs)

Take method to allow indexing like a numpy array.

to_pandas([use_mark])

Convert the CategoricalArray to a pandas Series with categorical dtype.

Attributes#

marked_categories

Get the categories with the mark prefix.

ndim

Get the number of dimensions of the codes array.

shape

Get the shape of the codes array.

size

Get the size of the codes array.