Skip to content

Commit e2d2666

Browse files
Doc changes
1 parent 0a95a67 commit e2d2666

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

doc/source/user_guide/advanced.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,12 @@ values **not** in the categories, similarly to how you can reindex **any** panda
783783

784784
.. ipython:: python
785785
786-
df2.iloc[[0]].reindex(['a', 'e'])
787-
df2.iloc[[0]].reindex(['a', 'e']).index
788-
df2.iloc[[0]].reindex(pd.Categorical(['a', 'e'], categories=list('abe')))
789-
df2.iloc[[0]].reindex(pd.Categorical(['a', 'e'], categories=list('abe'))).index
786+
df3 = pd.DataFrame({'A': np.arange(3), 'B': pd.Series(list('abc')).astype('category')})
787+
df3 = df3.set_index('B')
788+
df3.reindex(['a', 'e'])
789+
df3.reindex(['a', 'e']).index
790+
df3.reindex(pd.Categorical(['a', 'e'], categories=list('abe')))
791+
df3.reindex(pd.Categorical(['a', 'e'], categories=list('abe'))).index
790792
791793
.. warning::
792794

doc/source/whatsnew/v1.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Categorical
8989
^^^^^^^^^^^
9090

9191
- Added test to assert the :func:`fillna` raises the correct ValueError message when the value isn't a value from categories (:issue:`13628`)
92-
- For :class:`CategoricalIndex`, `DataFrame.reindex` would fail when the targets contained duplicates, and wouldn't fail if the source contained duplicates (:issue:`28107`)
92+
- 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`)
9393
-
9494

9595

0 commit comments

Comments
 (0)