Skip to content

Commit 6a184c8

Browse files
committed
Modify after review
1 parent f9d9bc5 commit 6a184c8

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

doc/source/whatsnew/v1.0.0.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ The following methods now also correctly output values for unobserved categories
235235
df.groupby(["cat_1", "cat_2"], observed=False)["value"].count()
236236
237237
238-
By default :meth:`Categorical.min` and :meth:`Categorical.max` return the min and the max respectively
239-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
238+
By default :meth:`Categorical.min` return the min and the max respectively
239+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
240240

241-
When :class:`Categorical` contains ``np.nan``, :meth:`Categorical.min` and :meth:`Categorical.max`
242-
no longer return ``np.nan`` by default.
241+
When :class:`Categorical` contains ``np.nan``,
242+
:meth:`Categorical.min` no longer return ``np.nan`` by default (skipna=True).
243243

244244
*pandas 0.25.x*
245245

pandas/core/arrays/categorical.py

-12
Original file line numberDiff line numberDiff line change
@@ -2197,12 +2197,6 @@ def min(self, skipna=True, **kwargs):
21972197
if skipna:
21982198
pointer = self._codes[good].min(**kwargs)
21992199
else:
2200-
if skipna is None:
2201-
msg = (
2202-
"The default value of skipna will be changed to "
2203-
"True in the future version."
2204-
)
2205-
warn(msg, FutureWarning, stacklevel=2)
22062200
return np.nan
22072201
else:
22082202
pointer = self._codes.min(**kwargs)
@@ -2230,12 +2224,6 @@ def max(self, skipna=True, **kwargs):
22302224
if skipna:
22312225
pointer = self._codes[good].max(**kwargs)
22322226
else:
2233-
if skipna is None:
2234-
msg = (
2235-
"The default value of skipna will be changed to "
2236-
"True in the future version."
2237-
)
2238-
warn(msg, FutureWarning, stacklevel=2)
22392227
return np.nan
22402228
else:
22412229
pointer = self._codes.max(**kwargs)

pandas/tests/arrays/categorical/test_analytics.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ def test_deprecate_numeric_only_min_max(self, method):
7070
cat = Categorical(
7171
[np.nan, 1, 2, np.nan], categories=[5, 4, 3, 2, 1], ordered=True
7272
)
73-
with tm.assert_produces_warning(
74-
expected_warning=FutureWarning, check_stacklevel=False
75-
):
73+
with tm.assert_produces_warning(expected_warning=FutureWarning):
7674
getattr(cat, method)(numeric_only=True)
7775

7876
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)