Skip to content

Commit db711fe

Browse files
Doc changes
1 parent 46f1d66 commit db711fe

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

doc/source/user_guide/advanced.rst

+6-4
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Categorical
106106
^^^^^^^^^^^
107107

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

112112

0 commit comments

Comments
 (0)