Skip to content

Commit c91f305

Browse files
DOC: update section on CategoricalIndex in categorical docs
1 parent 90bbe35 commit c91f305

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

doc/source/categorical.rst

+13-10
Original file line numberDiff line numberDiff line change
@@ -813,12 +813,16 @@ basic type) and applying along columns will also convert to object.
813813
df.apply(lambda row: type(row["cats"]), axis=1)
814814
df.apply(lambda col: col.dtype, axis=0)
815815
816-
No Categorical Index
817-
~~~~~~~~~~~~~~~~~~~~
816+
Categorical Index
817+
~~~~~~~~~~~~~~~~~
818+
819+
.. versionadded:: 0.16.1
820+
821+
A new ``CategoricalIndex`` index type is introduced in version 0.16.1. See the
822+
:ref:`advanced indexing docs <indexing.categoricalindex>` for a more detailed
823+
explanation.
818824

819-
There is currently no index of type ``category``, so setting the index to categorical column will
820-
convert the categorical data to a "normal" dtype first and therefore remove any custom
821-
ordering of the categories:
825+
Setting the index, will create create a ``CategoricalIndex``
822826

823827
.. ipython:: python
824828
@@ -827,13 +831,12 @@ ordering of the categories:
827831
values = [4,2,3,1]
828832
df = DataFrame({"strings":strings, "values":values}, index=cats)
829833
df.index
830-
# This should sort by categories but does not as there is no CategoricalIndex!
834+
# This now sorts by the categories order
831835
df.sort_index()
832836
833-
.. note::
834-
This could change if a `CategoricalIndex` is implemented (see
835-
https://github.com/pydata/pandas/issues/7629)
836-
837+
In previous versions (<0.16.1) there is no index of type ``category``, so
838+
setting the index to categorical column will convert the categorical data to a
839+
"normal" dtype first and therefore remove any custom ordering of the categories.
837840

838841
Side Effects
839842
~~~~~~~~~~~~

0 commit comments

Comments
 (0)