-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ENH: NDFrame.axis_ops #52461
ENH: NDFrame.axis_ops #52461
Conversation
@phofl updated to include more underscores |
pandas/core/axis_ops.py
Outdated
|
||
Let's reorder the levels of the index: | ||
|
||
>>> df.reorder_levels(["diet", "class"]) |
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.
Shouldn't these example show the new usage of df.axis_ops.foo
?
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.
Does axis_ops
render in the API reference docs?
doc/source/whatsnew/v0.18.1.rst
Outdated
@@ -190,6 +190,7 @@ Partial string indexing now matches on ``DateTimeIndex`` when part of a ``MultiI | |||
On other levels | |||
|
|||
.. ipython:: python | |||
:okwarning: |
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.
Could you just change this to use axis_ops.swaplevel
?
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.
i dont think we'd want to change this in the old doc
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.
Okay could we use code block
instead?
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.
Could you also ensure the API reference page advertises e.g. DataFrame.axis_ops.foo
instead of DataFrame.foo
?
I'm not clear on how that works. For e.g. swaplevel would I remove the entry for Series.swaplevel in source/reference/series.rst? I could add Series.axis_ops in the same place but will adding Series.axis_ops.swap_level render? |
I think so. I think we have an |
An alternative: just deprecate tz_localize, tz_convert, to_timestamp, to_period and leave the others as-is |
Yeah actually that's a good point. if there's an |
Closing for lack of interest, will do individual deprecations in the subset of cases where that is feasible |
Reopening, will merge main and push shortly. |
FWIW, while I understand the reason for adding something like this, I would not be very enthusiastic about an |
Refactor out NDFrame methods that operate only on axes into an
obj.axis_ops
namespace. I'd want to do this in conjunction with a deprecation of the methods themselves xref #52110