@@ -134,9 +134,12 @@ One place that deserves special mention is in :meth:`read_csv`. Previously, with
134
134
be strings.
135
135
136
136
.. ipython:: python
137
+ :suppress:
137
138
138
139
from pandas.compat import StringIO
139
140
141
+ .. ipython:: python
142
+
140
143
data = 'A,B\na,1\nb,2\nc,3'
141
144
pd.read_csv(StringIO(data), dtype={'B': 'category'}).B.cat.categories
142
145
@@ -151,11 +154,12 @@ timedeltas, we can automatically convert to the correct type
151
154
The values have been correctly interpreted as integers.
152
155
153
156
The ``.dtype`` property of a ``Categorical``, ``CategoricalIndex`` or a
154
- ``Series`` with categorical type will now return an instance of ``CategoricalDtype``.
155
- For the most part, this is backwards compatible, though the string repr has changed.
156
- If you were previously using ``str(s.dtype == 'category')`` to detect categorical data,
157
- switch to :func:`api.types.is_categorical_dtype`, which is compatible with the old and
158
- new ``CategoricalDtype``.
157
+ ``Series`` with categorical type will now return an instance of
158
+ ``CategoricalDtype``. For the most part, this is backwards compatible, though
159
+ the string repr has changed. If you were previously using ``str(s.dtype) ==
160
+ 'category'`` to detect categorical data, switch to
161
+ :func:`pandas.api.types.is_categorical_dtype`, which is compatible with the old
162
+ and new ``CategoricalDtype``.
159
163
160
164
See the :ref:`CategoricalDtype docs <categorical.categoricaldtype>` for more.
161
165
0 commit comments