Skip to main content
`Ctrl`+`K`

# pandas.Series.cat.as_unordered

Series.cat.as_unordered()

  Set the Categorical to be unordered.

  This method returns a new Categorical with the ordered attribute set to False, disabling comparison operations between categories.

  Returns:
    Categorical

      Unordered Categorical.

  See also

  `as_ordered`

    Set the Categorical to be ordered.

  Examples

  For `pandas.Series`:

      >>> raw_cat = pd.Categorical(["a", "b", "c", "a"], ordered=True)
      >>> ser = pd.Series(raw_cat)
      >>> ser.cat.ordered
      True
      >>> ser = ser.cat.as_unordered()
      >>> ser.cat.ordered
      False

  For `pandas.CategoricalIndex`:

      >>> ci = pd.CategoricalIndex(["a", "b", "c", "a"], ordered=True)
      >>> ci.ordered
      True
      >>> ci = ci.as_unordered()
      >>> ci.ordered
      False