Skip to content

Commit 095e6da

Browse files
committed
Fix black issue and the test error
1 parent 300a862 commit 095e6da

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

pandas/core/arrays/categorical.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,9 +2216,12 @@ def min(self, skipna=None, **kwargs):
22162216
if skipna:
22172217
pointer = self._codes[good].min(**kwargs)
22182218
else:
2219-
msg = ("The default value of skipna will be changed to "
2220-
"True in the future version.")
2221-
warn(msg, FutureWarning, stacklevel=2)
2219+
if skipna is None:
2220+
msg = (
2221+
"The default value of skipna will be changed to "
2222+
"True in the future version."
2223+
)
2224+
warn(msg, FutureWarning, stacklevel=2)
22222225
return np.nan
22232226
else:
22242227
pointer = self._codes.min(**kwargs)
@@ -2246,9 +2249,12 @@ def max(self, skipna=None, **kwargs):
22462249
if skipna:
22472250
pointer = self._codes[good].max(**kwargs)
22482251
else:
2249-
msg = ("The default value of skipna will be changed to "
2250-
"True in the future version.")
2251-
warn(msg, FutureWarning, stacklevel=2)
2252+
if skipna is None:
2253+
msg = (
2254+
"The default value of skipna will be changed to "
2255+
"True in the future version."
2256+
)
2257+
warn(msg, FutureWarning, stacklevel=2)
22522258
return np.nan
22532259
else:
22542260
pointer = self._codes.max(**kwargs)

pandas/tests/arrays/categorical/test_analytics.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ 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(expected_warning=FutureWarning,
74-
check_stacklevel=False):
73+
with tm.assert_produces_warning(
74+
expected_warning=FutureWarning, check_stacklevel=False
75+
):
7576
getattr(cat, method)(numeric_only=True)
7677

7778
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)