Skip to content

Document some more categorical methods #56928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/source/reference/arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,21 @@ To create a Series of dtype ``category``, use ``cat = s.astype(dtype)`` or
If the :class:`Series` is of dtype :class:`CategoricalDtype`, ``Series.cat`` can be used to change the categorical
data. See :ref:`api.series.cat` for more.

More methods are available on :class:`Categorical`:

.. autosummary::
:toctree: api/

Categorical.as_ordered
Categorical.as_unordered
Categorical.set_categories
Categorical.rename_categories
Categorical.reorder_categories
Categorical.add_categories
Categorical.remove_categories
Categorical.remove_unused_categories
Categorical.map

.. _api.arrays.sparse:

Sparse
Expand Down
9 changes: 9 additions & 0 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,15 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi
Methods
-------
from_codes
as_ordered
as_unordered
set_categories
rename_categories
reorder_categories
add_categories
remove_categories
remove_unused_categories
map
__array__

Raises
Expand Down