-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Deprecate passing args as positional in sort_values #41505
Deprecate passing args as positional in sort_values #41505
Conversation
d8da296
to
2a0270e
Compare
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -647,6 +647,7 @@ Deprecations | |||
- Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`) | |||
- Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`) | |||
- Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`) | |||
- Deprecated passing arguments as positional (except for ``by``) in :meth:`DataFrame.sort_values` and :meth:`Series.sort_values` (:issue:`41485`) |
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.
this change won't solve the error: Signature of "sort_values" incompatible with supertype "NDFrame" [override]
. maybe we could also give by
a default value (the dataframe columns). The 'by' keyword could still be passed positionally if it has a default value.
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.
we could also perhaps deprecate the axis keyword on Series at the same time to clean this up further.
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.
we could also perhaps deprecate the axis keyword on Series at the same time to clean this up further.
I don't understand, wouldn't this be incompatible with the supertype?
maybe we could also give by a default value (the dataframe columns). The 'by' keyword could still be passed positionally if it has a default value.
Sure, could that - that could be done directly in 1.3 without a prior warning, right? As current behaviour would be preserved
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.
maybe we could also give by a default value (the dataframe columns). The 'by' keyword could still be passed positionally if it has a default value.
That might be a good idea, but I would personally leave that for a separate PR (as it seems an independent new feature)
doc/source/whatsnew/v1.3.0.rst
Outdated
@@ -647,6 +647,7 @@ Deprecations | |||
- Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`) | |||
- Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`) | |||
- Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`) | |||
- Deprecated passing arguments as positional (except for ``by``) in :meth:`DataFrame.sort_values` and :meth:`Series.sort_values` (:issue:`41485`) |
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.
- Deprecated passing arguments as positional (except for ``by``) in :meth:`DataFrame.sort_values` and :meth:`Series.sort_values` (:issue:`41485`) | |
- Deprecated passing arguments as positional in :meth:`DataFrame.sort_values` (except for ``by``) and :meth:`Series.sort_values` (:issue:`41485`) |
r"for the arguments 'self' and 'by' will be keyword-only" | ||
) | ||
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
df.sort_values("a", 0) |
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.
Same comment as in other PRs regarding asserting the result
…ord-args-sort_values
af0bf72
to
fee3211
Compare
…ord-args-sort_values
…ord-args-sort_values
inplace
#41485