pandas.Categorical.from_codes — pandas 0.24.0rc1 documentation (original) (raw)

codes : array-like, integers

An integer array, where each integer points to a category in categories or dtype.categories, or else is -1 for NaN

categories : index-like, optional

The categories for the categorical. Items need to be unique. If the categories are not given here, then they must be provided in dtype.

ordered : bool, optional

Whether or not this categorical is treated as an ordered categorical. If not given here or in dtype, the resulting categorical will be unordered.

dtype : CategoricalDtype or the string “category”, optional

If CategoricalDtype, cannot be used together withcategories or ordered.

New in version 0.24.0: When dtype is provided, neither categories nor orderedshould be provided.