Skip to content

Commit ee5c97d

Browse files
committed
More docs
1 parent 5783c66 commit ee5c97d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

doc/source/categorical.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,15 @@ This information can be stored in a :class:`~pandas.CategoricalDtype`.
152152
The ``categories`` argument is optional, which implies that the actual categories
153153
should be inferred from whatever is present in the data.
154154

155+
.. ipython:: python
156+
157+
pd.CategoricalDtype(['a', 'b', 'c'])
158+
pd.CategoricalDtype(['a', 'b', 'c'], ordered=True)
159+
pd.CategoricalDtype()
160+
155161
A :class:`~pandas.CategoricalDtype` can be used in any place pandas expects a
156162
`dtype`. For example :func:`pandas.read_csv`, :func:`pandas.DataFrame.astype`,
157-
the Series constructor, etc.
163+
or the Series constructor.
158164

159165
As a convenience, you can use the string `'category'` in place of a
160166
:class:`pandas.CategoricalDtype` when you want the default behavior of
@@ -167,8 +173,9 @@ order of the ``categories`` is not considered
167173
.. ipython:: python
168174
169175
c1 = pd.CategoricalDtype(['a', 'b', 'c'], ordered=False)
170-
c2 = pd.CategoricalDtype(['b', 'c', 'a'], ordered=False)
171-
c1 == c2
176+
c1 == pd.CategoricalDtype(['b', 'c', 'a'], ordered=False)
177+
178+
c1 == pd.CategoricalDtype(['b', 'c', 'a'], ordered=True)
172179
173180
Finally, all instances compare equal to the string `'category'`
174181

0 commit comments

Comments
 (0)