Skip to content
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: deprecate rename_axis / reindex_axis ? #17833

Closed
jorisvandenbossche opened this issue Oct 10, 2017 · 6 comments
Closed

API: deprecate rename_axis / reindex_axis ? #17833

jorisvandenbossche opened this issue Oct 10, 2017 · 6 comments
Labels
API Design Deprecate Functionality to remove in pandas
Milestone

Comments

@jorisvandenbossche
Copy link
Member

Given we are adding the "labels, axis=0/1" idiom to reindex and rename itself (#12392, PR #17800), I think the specific reindex_axis and rename_axis will be superfluous.

Should be deprecate them?

@jorisvandenbossche jorisvandenbossche added API Design Deprecate Functionality to remove in pandas labels Oct 10, 2017
@jorisvandenbossche jorisvandenbossche added this to the 0.21.0 milestone Oct 10, 2017
@jreback
Copy link
Contributor

jreback commented Oct 10, 2017

yes

@TomAugspurger
Copy link
Contributor

They aren't quite superfluous, as DataFrame.rename_axis can change .index.name and .columns.name:

In [13]: df = pd.DataFrame({"A": [1, 2, 3]})

In [14]: df.rename_axis("foo")
Out[14]:
     A
foo
0    1
1    2
2    3

In [15]: df.rename_axis("foo", axis=1)
Out[15]:
foo  A
0    1
1    2
2    3

I'm really regretting the approach I took in #11980 for overloading rename :/

@jorisvandenbossche
Copy link
Member Author

For rename_axis that is true, and that is certainly useful. But we could deprecate the part that relabeling of the axis?

But I don't think it is the case for reindex_axis ?

I'm really regretting the approach I took in #11980 for overloading rename :/

Yes, but that is still something else no? s.name vs s.index.name ?

@TomAugspurger
Copy link
Contributor

But we could deprecate the part that relabeling of the axis?

Ahh, yes, I suppose we could do that. I can start a PR now for it and reindex_axis.

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Oct 10, 2017
TomAugspurger added a commit that referenced this issue Oct 11, 2017
* API: Deprecate renamae_axis and reindex_axis

Closes #17833

* REF: Refactor axis style validator to generic

This sets us up to re-use it for Panel reindex

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* Ugh

* fixup! API: Deprecate renamae_axis and reindex_axis

* Fixup
ghost pushed a commit to reef-technologies/pandas that referenced this issue Oct 16, 2017
* API: Deprecate renamae_axis and reindex_axis

Closes pandas-dev#17833

* REF: Refactor axis style validator to generic

This sets us up to re-use it for Panel reindex

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* Ugh

* fixup! API: Deprecate renamae_axis and reindex_axis

* Fixup
alanbato pushed a commit to alanbato/pandas that referenced this issue Nov 10, 2017
* API: Deprecate renamae_axis and reindex_axis

Closes pandas-dev#17833

* REF: Refactor axis style validator to generic

This sets us up to re-use it for Panel reindex

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* Ugh

* fixup! API: Deprecate renamae_axis and reindex_axis

* Fixup
No-Stream pushed a commit to No-Stream/pandas that referenced this issue Nov 28, 2017
* API: Deprecate renamae_axis and reindex_axis

Closes pandas-dev#17833

* REF: Refactor axis style validator to generic

This sets us up to re-use it for Panel reindex

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* fixup! API: Deprecate renamae_axis and reindex_axis

* Ugh

* fixup! API: Deprecate renamae_axis and reindex_axis

* Fixup
@mpmX
Copy link

mpmX commented Mar 9, 2018

I use df = df.reindex_axis(sorted(df.columns), axis=1) to sort columns alphabetically and got a FutureWarning once in the past.

FutureWarning: '.reindex_axis' is deprecated and will be removed in a future version. Use '.reindex' instead.

The warning did not occur since then, so I wonder what the current state is.

@toobaz
Copy link
Member

toobaz commented Sep 15, 2019

I use df = df.reindex_axis(sorted(df.columns), axis=1) to sort columns alphabetically and got a FutureWarning once in the past.

Got the same problem in old code... solved with df = df.loc[:, sorted(df.columns)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Deprecate Functionality to remove in pandas
Projects
None yet
Development

No branches or pull requests

5 participants