Skip to content

Commit aaf91f7

Browse files
Making the deprecated example not be runnable since it warns now
1 parent f8a069a commit aaf91f7

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

doc/source/whatsnew/v2.1.0.rst

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,26 @@ and ``na_action="ignore"`` did not work correctly for any :class:`.ExtensionArra
171171
172172
*New behavior*:
173173

174-
.. ipython:: python
175-
:okwarning:
176-
177-
ser = pd.Series(["a", "b", np.nan], dtype="category")
178-
ser.map(str.upper, na_action="ignore")
179-
df = pd.DataFrame(ser)
180-
df.map(str.upper, na_action="ignore")
181-
idx = pd.Index(ser)
182-
idx.map(str.upper, na_action="ignore")
174+
.. code-block:: ipython
175+
176+
In [1]: ser = pd.Series(["a", "b", np.nan], dtype="category")
177+
In [2]: ser.map(str.upper, na_action="ignore")
178+
Out[2]:
179+
0 A
180+
1 B
181+
2 NaN
182+
dtype: category
183+
Categories (2, object): ['A', 'B']
184+
In [3]: df = pd.DataFrame(ser)
185+
In [4]: df.map(str.upper, na_action="ignore")
186+
Out[4]:
187+
0
188+
0 A
189+
1 B
190+
2 NaN
191+
In [5]: idx = pd.Index(ser)
192+
In [6]: idx.map(str.upper, na_action="ignore")
193+
Out[6]: CategoricalIndex(['A', 'B', nan], categories=['A', 'B'], ordered=False, dtype='category')
183194
184195
Also, note that :meth:`Categorical.map` implicitly has had its ``na_action`` set to ``"ignore"`` by default.
185196
This has been deprecated and the default for :meth:`Categorical.map` will change

0 commit comments

Comments
 (0)