File tree 1 file changed +13
-10
lines changed
1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -813,12 +813,16 @@ basic type) and applying along columns will also convert to object.
813
813
df.apply(lambda row : type (row[" cats" ]), axis = 1 )
814
814
df.apply(lambda col : col.dtype, axis = 0 )
815
815
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.
818
824
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 ``
822
826
823
827
.. ipython :: python
824
828
@@ -827,13 +831,12 @@ ordering of the categories:
827
831
values = [4 ,2 ,3 ,1 ]
828
832
df = DataFrame({" strings" :strings, " values" :values}, index = cats)
829
833
df.index
830
- # This should sort by categories but does not as there is no CategoricalIndex!
834
+ # This now sorts by the categories order
831
835
df.sort_index()
832
836
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.
837
840
838
841
Side Effects
839
842
~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments