Skip to content

Commit d838181

Browse files
committed
Undo the change in categorical.rst
1 parent 8497da5 commit d838181

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

doc/source/user_guide/categorical.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,4 +1185,12 @@ Counting CategoricalDtype
11851185
~~~~~~~~~~~~~~~~~~~~~~~~~
11861186

11871187
As mentioned in :ref:`Equality Semantics <categorical.equalitysemantics>`, two instances of :class:`~pandas.api.types.CategoricalDtype` compare equal
1188-
whenever they have the same categories and order. Therefore, the multiple instances of :class:`~pandas.api.types.CategoricalDtype` will be counted as one group if they have the same categories and order.
1188+
whenever they have the same categories and order. Therefore, when counting data types, the multiple instances of :class:`~pandas.api.types.CategoricalDtype` will be counted as one group if they have the same categories and order.
1189+
In the example below, even though ``a``, ``c``, and ``d`` all have data types of ``category``, they will not be counted as one group since they don't have the same categories.
1190+
1191+
.. ipython:: python
1192+
1193+
df = pd.DataFrame({'a': [1], 'b': ['2'], 'c': [3], 'd': [3]}).astype({'a': 'category', 'c': 'category', 'd': 'category'})
1194+
df
1195+
df.dtypes
1196+
df.dtypes.value_counts()

0 commit comments

Comments
 (0)