hipdf.Index.is_categorical

hipdf.Index.is_categorical#

21 min read time

Applies to Linux

Index.is_categorical()#

Check if the Index holds categorical data.

Deprecated since version 23.04: Use cudf.api.types.is_categorical_dtype instead.

Returns#

bool

True if the Index is categorical.

See Also#

CategoricalIndex : Index for categorical data. is_boolean : Check if the Index only consists of booleans. is_integer : Check if the Index only consists of integers. is_floating : Check if the Index is a floating type. is_numeric : Check if the Index only consists of numeric data. is_object : Check if the Index is of the object dtype. is_interval : Check if the Index holds Interval objects.

Examples#

>>> import cudf
>>> idx = cudf.Index(["Watermelon", "Orange", "Apple",
...                 "Watermelon"]).astype("category")
>>> idx.is_categorical()
True
>>> idx = cudf.Index([1, 3, 5, 7])
>>> idx.is_categorical()
False
>>> s = cudf.Series(["Peter", "Victor", "Elisabeth", "Mar"])
>>> s
0        Peter
1       Victor
2    Elisabeth
3          Mar
dtype: object
>>> s.index.is_categorical()
False