cudf.core.column.categorical.CategoricalAccessor.as_unordered#
- CategoricalAccessor.as_unordered(inplace: bool = False) Optional[SeriesOrIndex] #
Set the Categorical to be unordered.
- Parameters:
- inplacebool, default False
Whether or not to set the ordered attribute in-place or return a copy of this categorical with ordered set to False.
Deprecated since version 23.02: The inplace parameter is is deprecated and will be removed in a future version of cudf. Setting categories as unordered will always return a new Categorical object.
- 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] >>> s.cat.as_unordered(inplace=True) >>> s 0 10 1 1 2 1 3 2 4 10 5 2 6 10 dtype: category Categories (3, int64): [1, 2, 10]