Skip to content

Commit 860ce75

Browse files
author
tp
committed
Fixed errors in doc string for Categorical + cleanup
1 parent d43aba8 commit 860ce75

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

pandas/core/categorical.py

+13-14
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,23 @@ class Categorical(PandasObject):
196196
197197
Examples
198198
--------
199-
>>> from pandas import Categorical
200-
>>> Categorical([1, 2, 3, 1, 2, 3])
199+
>>> pd.Categorical([1, 2, 3, 1, 2, 3])
201200
[1, 2, 3, 1, 2, 3]
202-
Categories (3, int64): [1 < 2 < 3]
201+
Categories (3, int64): [1, 2, 3]
203202
204-
>>> Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
203+
>>> pd.Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
205204
[a, b, c, a, b, c]
206-
Categories (3, object): [a < b < c]
205+
Categories (3, object): [a, b, c]
207206
208-
Only ordered `Categoricals` can be sorted (according to the order
209-
of the categories) and have a min and max value.
207+
Ordered `Categoricals` can be sorted according to the custom order
208+
of the categories and can have a min and max value.
210209
211-
>>> a = Categorical(['a','b','c','a','b','c'], ['c', 'b', 'a'],
212-
ordered=True)
213-
>>> a.min()
210+
>>> c = pd.Categorical(['a','b','c','a','b','c'], categories=['c', 'b', 'a'],
211+
... ordered=True)
212+
>>> c
213+
[a, b, c, a, b, c]
214+
Categories (3, object): [c < b < a]
215+
>>> c.min()
214216
'c'
215217
216218
Notes
@@ -219,11 +221,8 @@ class Categorical(PandasObject):
219221
220222
See also
221223
--------
222-
Categorical.sort
223-
Categorical.order
224-
Categorical.min
225-
Categorical.max
226224
pandas.api.types.CategoricalDtype
225+
CategoricalIndex : An Index with an underlying ``Categorical``
227226
"""
228227

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

0 commit comments

Comments
 (0)