diff --git a/doc/source/categorical.rst b/doc/source/categorical.rst index 317641f1b3eea..bb8a896a5b91c 100644 --- a/doc/source/categorical.rst +++ b/doc/source/categorical.rst @@ -182,6 +182,18 @@ It's also possible to pass in the categories in a specific order: indicate an ordered ``Categorical``. +.. note:: + + The result of ``Series.unique()`` is not always the same as ``Series.cat.categories``, + because ``Series.unique()`` has a couple of guarantees, namely that it returns categories + in the order of appearance, and it only includes values that are actually present. + + .. ipython:: python + + s = pd.Series(list('babc')).astype('category', categories=list('abcd')) + s.unique() + s.cat.categories + Renaming categories ~~~~~~~~~~~~~~~~~~~