-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
API/DEPR: Change default skipna behaviour + deprecate numeric_only in Categorical.min and max #27929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API/DEPR: Change default skipna behaviour + deprecate numeric_only in Categorical.min and max #27929
Changes from 1 commit
9fab462 4bfe686 e4d5c38 765e506 300a862 095e6da f094635 7d73163 f9d9bc5 6a184c8 ac89bcd 9691c44 d281650 23ffd16 260201c File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -2216,9 +2216,12 @@ def min(self, skipna=None, **kwargs): | |
| if skipna: | ||
| pointer = self._codes[good].min(**kwargs) | ||
| else: | ||
| msg = ("The default value of skipna will be changed to " | ||
| "True in the future version.") | ||
| warn(msg, FutureWarning, stacklevel=2) | ||
| if skipna is None: | ||
| msg = ( | ||
| "The default value of skipna will be changed to " | ||
| "True in the future version." | ||
| ) | ||
| warn(msg, FutureWarning, stacklevel=2) | ||
| return np.nan | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not correct for i8 types, which should be pd.NaT. how to fix this? Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could check the | ||
| else: | ||
| pointer = self._codes.min(**kwargs) | ||
| | @@ -2246,9 +2249,12 @@ def max(self, skipna=None, **kwargs): | |
| if skipna: | ||
| pointer = self._codes[good].max(**kwargs) | ||
| else: | ||
| msg = ("The default value of skipna will be changed to " | ||
| "True in the future version.") | ||
| warn(msg, FutureWarning, stacklevel=2) | ||
| if skipna is None: | ||
| ||
| msg = ( | ||
| "The default value of skipna will be changed to " | ||
| "True in the future version." | ||
| ) | ||
| warn(msg, FutureWarning, stacklevel=2) | ||
| return np.nan | ||
| else: | ||
| pointer = self._codes.max(**kwargs) | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -70,8 +70,9 @@ def test_deprecate_numeric_only_min_max(self, method): | |
| cat = Categorical( | ||
| [np.nan, 1, 2, np.nan], categories=[5, 4, 3, 2, 1], ordered=True | ||
| ) | ||
| with tm.assert_produces_warning(expected_warning=FutureWarning, | ||
| check_stacklevel=False): | ||
| with tm.assert_produces_warning( | ||
| expected_warning=FutureWarning, check_stacklevel=False | ||
| ||
| ): | ||
| getattr(cat, method)(numeric_only=True) | ||
| | ||
| @pytest.mark.parametrize( | ||
| | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this
if skipna is Noneblock with the warning I think?