Defined in awkward.operations.ak_categories on line 13.

ak.categories(array, highlevel=True, *, behavior=None, attrs=None)#
  • 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.

If the array is categorical (contains ak.contents.IndexedArray or ak.contents.IndexedOptionArray labeled with parameter "__array__" = "categorical"), then this function returns its categories.

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