Skip to content

DOC: Fixed errors in doc string for Categorical + cleanup #17655

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 1 commit into from
Sep 25, 2017
Merged
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
30 changes: 15 additions & 15 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,34 +196,34 @@ class Categorical(PandasObject):

Examples
--------
>>> from pandas import Categorical
>>> Categorical([1, 2, 3, 1, 2, 3])
>>> pd.Categorical([1, 2, 3, 1, 2, 3])
[1, 2, 3, 1, 2, 3]
Categories (3, int64): [1 < 2 < 3]
Categories (3, int64): [1, 2, 3]

>>> Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
>>> pd.Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
[a, b, c, a, b, c]
Categories (3, object): [a < b < c]
Categories (3, object): [a, b, c]

Only ordered `Categoricals` can be sorted (according to the order
of the categories) and have a min and max value.
Ordered `Categoricals` can be sorted according to the custom order
of the categories and can have a min and max value.

>>> a = Categorical(['a','b','c','a','b','c'], ['c', 'b', 'a'],
ordered=True)
>>> a.min()
>>> c = pd.Categorical(['a','b','c','a','b','c'], ordered=True,
... categories=['c', 'b', 'a'])
>>> c
[a, b, c, a, b, c]
Categories (3, object): [c < b < a]
>>> c.min()
'c'

Notes
-----
See the :ref:`user guide <categorical>` for more.
See the `user guide
<http://pandas.pydata.org/pandas-docs/stable/categorical.html>`_ for more.

See also
--------
Categorical.sort
Categorical.order
Categorical.min
Categorical.max
pandas.api.types.CategoricalDtype
CategoricalIndex : An Index with an underlying ``Categorical``
"""

# For comparisons, so that numpy uses our implementation if the compare
Expand Down