cudf.core.column.categorical.CategoricalAccessor.as_unordered#

CategoricalAccessor.as_unordered() SeriesOrIndex | None#

Set the Categorical to be unordered.

Returns:
Categorical

Unordered Categorical or None if inplace.

Examples

>>> import cudf
>>> s = cudf.Series([10, 1, 1, 2, 10, 2, 10], dtype="category")
>>> s
0    10
1     1
2     1
3     2
4    10
5     2
6    10
dtype: category
Categories (3, int64): [1, 2, 10]
>>> s = s.cat.as_ordered()
>>> s
0    10
1     1
2     1
3     2
4    10
5     2
6    10
dtype: category
Categories (3, int64): [1 < 2 < 10]
>>> s.cat.as_unordered()
0    10
1     1
2     1
3     2
4    10
5     2
6    10
dtype: category
Categories (3, int64): [1, 2, 10]