cudf.core.dtypes.CategoricalDtype.from_pandas#

classmethod CategoricalDtype.from_pandas(dtype: CategoricalDtype) CategoricalDtype[source]#

Convert a pandas.CategrocialDtype to cudf.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, categories_dtype=object)
>>> cudf_dtype = cudf.CategoricalDtype.from_pandas(pd_dtype)
>>> cudf_dtype
CategoricalDtype(categories=['b', 'a'], ordered=True, categories_dtype=object)