@classmethod
def from_codes(cls, codes, categories, ordered=False):
    '\n        Make a Categorical type from codes and categories arrays.\n\n        This constructor is useful if you already have codes and categories and\n        so do not need the (computation intensive) factorization step, which is\n        usually done on the constructor.\n\n        If your data does not follow this convention, please use the normal\n        constructor.\n\n        Parameters\n        ----------\n        codes : array-like, integers\n            An integer array, where each integer points to a category in\n            categories or -1 for NaN\n        categories : index-like\n            The categories for the categorical. Items need to be unique.\n        ordered : boolean, (default False)\n            Whether or not this categorical is treated as a ordered\n            categorical. If not given, the resulting categorical will be\n            unordered.\n        '
    codes = np.asarray(codes)
    if (not is_integer_dtype(codes)):
        msg = 'codes need to be array-like integers'
        if is_float_dtype(codes):
            icodes = codes.astype('i8')
            if (icodes == codes).all():
                msg = None
                codes = icodes
                warn('float codes will be disallowed in the future and raise a ValueError', FutureWarning, stacklevel=2)
        if msg:
            raise ValueError(msg)
    try:
        codes = coerce_indexer_dtype(codes, categories)
    except (ValueError, TypeError):
        raise ValueError('codes need to be convertible to an arrays of integers')
    categories = CategoricalDtype.validate_categories(categories)
    if (len(codes) and ((codes.max() >= len(categories)) or (codes.min() < (- 1)))):
        raise ValueError('codes need to be between -1 and len(categories)-1')
    return cls(codes, categories=categories, ordered=ordered, fastpath=True)
Make a Categorical type from codes and categories arrays.

This constructor is useful if you already have codes and categories and
so do not need the (computation intensive) factorization step, which is
usually done on the constructor.

If your data does not follow this convention, please use the normal
constructor.

Parameters
----------
codes : array-like, integers
    An integer array, where each integer points to a category in
    categories or -1 for NaN
categories : index-like
    The categories for the categorical. Items need to be unique.
ordered : boolean, (default False)
    Whether or not this categorical is treated as a ordered
    categorical. If not given, the resulting categorical will be
    unordered.
@classmethod
def from_codes(cls, codes, categories, ordered=False):
    '\n        Make a Categorical type from codes and categories arrays.\n\n        This constructor is useful if you already have codes and categories and\n        so do not need the (computation intensive) factorization step, which is\n        usually done on the constructor.\n\n        If your data does not follow this convention, please use the normal\n        constructor.\n\n        Parameters\n        ----------\n        codes : array-like, integers\n            An integer array, where each integer points to a category in\n            categories or -1 for NaN\n        categories : index-like\n            The categories for the categorical. Items need to be unique.\n        ordered : boolean, (default False)\n            Whether or not this categorical is treated as a ordered\n            categorical. If not given, the resulting categorical will be\n            unordered.\n        '
    codes = np.asarray(codes)
    if (not is_integer_dtype(codes)):
        msg = 'codes need to be array-like integers'
        if is_float_dtype(codes):
            icodes = codes.astype('i8')
            if (icodes == codes).all():
                msg = None
                codes = icodes
                warn('float codes will be disallowed in the future and raise a ValueError', FutureWarning, stacklevel=2)
        if msg:
            raise ValueError(msg)
    try:
        codes = coerce_indexer_dtype(codes, categories)
    except (ValueError, TypeError):
        raise ValueError('codes need to be convertible to an arrays of integers')
    categories = CategoricalDtype.validate_categories(categories)
    if (len(codes) and ((codes.max() >= len(categories)) or (codes.min() < (- 1)))):
        raise ValueError('codes need to be between -1 and len(categories)-1')
    return cls(codes, categories=categories, ordered=ordered, fastpath=True)