ak.from_categorical#

Defined in awkward.operations.ak_from_categorical on line 13.

ak.from_categorical(array, *, highlevel=True, behavior=None, attrs=None)#
Parameters:
  • array – Array-like data (anything ak.to_layout recognizes).

  • highlevel (bool) – If True, return an ak.Array; otherwise, return a low-level ak.contents.Content subclass.

  • behavior (None or dict) – Custom ak.behavior for the output array, if high-level.

  • attrs (None or dict) – Custom attributes for the output array, if high-level.

This function replaces categorical data with non-categorical data (by removing the label that declares it as such).

This is a metadata-only operation; the running time does not scale with the size of the dataset. (Conversion to categorical is expensive; conversion from categorical is cheap.)

See also ak.is_categorical, ak.categories, ak.str.to_categorical.