@@ -152,9 +152,15 @@ This information can be stored in a :class:`~pandas.CategoricalDtype`.
152
152
The ``categories `` argument is optional, which implies that the actual categories
153
153
should be inferred from whatever is present in the data.
154
154
155
+ .. ipython :: python
156
+
157
+ pd.CategoricalDtype([' a' , ' b' , ' c' ])
158
+ pd.CategoricalDtype([' a' , ' b' , ' c' ], ordered = True )
159
+ pd.CategoricalDtype()
160
+
155
161
A :class: `~pandas.CategoricalDtype ` can be used in any place pandas expects a
156
162
`dtype `. For example :func: `pandas.read_csv `, :func: `pandas.DataFrame.astype `,
157
- the Series constructor, etc .
163
+ or the Series constructor.
158
164
159
165
As a convenience, you can use the string `'category' ` in place of a
160
166
:class: `pandas.CategoricalDtype ` when you want the default behavior of
@@ -167,8 +173,9 @@ order of the ``categories`` is not considered
167
173
.. ipython :: python
168
174
169
175
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 )
172
179
173
180
Finally, all instances compare equal to the string `'category' `
174
181
0 commit comments