From db711fe2dee53790cdaee7d8a38dd2168a3ffde6 Mon Sep 17 00:00:00 2001 From: Max Bolingbroke Date: Tue, 10 Sep 2019 19:16:28 +0100 Subject: [PATCH] Doc changes --- doc/source/user_guide/advanced.rst | 10 ++++++---- doc/source/whatsnew/v1.0.0.rst | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/source/user_guide/advanced.rst b/doc/source/user_guide/advanced.rst index 6c8e6dcbb1db9a..5a86561fb51010 100644 --- a/doc/source/user_guide/advanced.rst +++ b/doc/source/user_guide/advanced.rst @@ -783,10 +783,12 @@ values **not** in the categories, similarly to how you can reindex **any** panda .. ipython:: python - df2.iloc[[0]].reindex(['a', 'e']) - df2.iloc[[0]].reindex(['a', 'e']).index - df2.iloc[[0]].reindex(pd.Categorical(['a', 'e'], categories=list('abe'))) - df2.iloc[[0]].reindex(pd.Categorical(['a', 'e'], categories=list('abe'))).index + df3 = pd.DataFrame({'A': np.arange(3), 'B': pd.Series(list('abc')).astype('category')}) + df3 = df3.set_index('B') + df3.reindex(['a', 'e']) + df3.reindex(['a', 'e']).index + df3.reindex(pd.Categorical(['a', 'e'], categories=list('abe'))) + df3.reindex(pd.Categorical(['a', 'e'], categories=list('abe'))).index .. warning:: diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 8276fc0a4c42d2..b95c5e3da55173 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -106,7 +106,7 @@ Categorical ^^^^^^^^^^^ - Added test to assert the :func:`fillna` raises the correct ValueError message when the value isn't a value from categories (:issue:`13628`) -- For :class:`CategoricalIndex`, `DataFrame.reindex` would fail when the targets contained duplicates, and wouldn't fail if the source contained duplicates (:issue:`28107`) +- For :class:`CategoricalIndex`, :meth:`DataFrame.reindex` with a :class:`CategoricalIndex`, would fail when the targets contained duplicates, and wouldn't fail if the source contained duplicates (:issue:`28107`) -