Skip to content

Commit 0d06216

Browse files
topper-123jorisvandenbossche
authored andcommitted
DOC: fixed errors in doc string for Categorical + cleanup (#17655)
1 parent 6da85b3 commit 0d06216

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

pandas/core/categorical.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -197,34 +197,34 @@ class Categorical(PandasObject):
197197
198198
Examples
199199
--------
200-
>>> from pandas import Categorical
201-
>>> Categorical([1, 2, 3, 1, 2, 3])
200+
>>> pd.Categorical([1, 2, 3, 1, 2, 3])
202201
[1, 2, 3, 1, 2, 3]
203-
Categories (3, int64): [1 < 2 < 3]
202+
Categories (3, int64): [1, 2, 3]
204203
205-
>>> Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
204+
>>> pd.Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
206205
[a, b, c, a, b, c]
207-
Categories (3, object): [a < b < c]
206+
Categories (3, object): [a, b, c]
208207
209-
Only ordered `Categoricals` can be sorted (according to the order
210-
of the categories) and have a min and max value.
208+
Ordered `Categoricals` can be sorted according to the custom order
209+
of the categories and can have a min and max value.
211210
212-
>>> a = Categorical(['a','b','c','a','b','c'], ['c', 'b', 'a'],
213-
ordered=True)
214-
>>> a.min()
211+
>>> c = pd.Categorical(['a','b','c','a','b','c'], ordered=True,
212+
... categories=['c', 'b', 'a'])
213+
>>> c
214+
[a, b, c, a, b, c]
215+
Categories (3, object): [c < b < a]
216+
>>> c.min()
215217
'c'
216218
217219
Notes
218220
-----
219-
See the :ref:`user guide <categorical>` for more.
221+
See the `user guide
222+
<http://pandas.pydata.org/pandas-docs/stable/categorical.html>`_ for more.
220223
221224
See also
222225
--------
223-
Categorical.sort
224-
Categorical.order
225-
Categorical.min
226-
Categorical.max
227226
pandas.api.types.CategoricalDtype
227+
CategoricalIndex : An Index with an underlying ``Categorical``
228228
"""
229229

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

0 commit comments

Comments
 (0)