cudf.CategoricalDtype.from_pandas#
- classmethod CategoricalDtype.from_pandas(dtype: CategoricalDtype) CategoricalDtype #
Convert a
pandas.CategrocialDtype
tocudf.CategoricalDtype
Examples
>>> import cudf >>> import pandas as pd >>> pd_dtype = pd.CategoricalDtype(categories=['b', 'a'], ordered=True) >>> pd_dtype CategoricalDtype(categories=['b', 'a'], ordered=True) >>> cudf_dtype = cudf.CategoricalDtype.from_pandas(pd_dtype) >>> cudf_dtype CategoricalDtype(categories=['b', 'a'], ordered=True)