Skip to content

DEPR: DataFrame.swapaxes #51946

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

Closed
jorisvandenbossche opened this issue Mar 13, 2023 · 4 comments · Fixed by #51960
Closed

DEPR: DataFrame.swapaxes #51946

jorisvandenbossche opened this issue Mar 13, 2023 · 4 comments · Fixed by #51960
Assignees
Labels
Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves

Comments

@jorisvandenbossche
Copy link
Member

This is listed in the general deprecation issue #18262.

Now that we have a max dimension of 2, i.e. DataFrame (while before you could have a 3D Panel or NDFrame), I don't think there is any use case for swapaxes where it's not exactly the same as transpose().
It's still implemented independently from transpose(), but I think that df.swapaxes(0, 1) and df.swapaxes(1, 0) are the only two valid options and that gives exactly the same as a transpose() (you can do eg df.swapaxes(0, 0) which is a no-op, but this generalization doesn't really seem worth keeping it as a separate method, I would say)

So let's deprecate it? (in favor of transpose())

@phofl
Copy link
Member

phofl commented Mar 13, 2023

Yeah I don't see a real use case for this either. +1

@luke396
Copy link
Contributor

luke396 commented Mar 14, 2023

take

@rhshadrach
Copy link
Member

+1

@rhshadrach rhshadrach added the Indexing Related to indexing on series/frames, not to indexes themselves label Mar 14, 2023
@luke396 luke396 mentioned this issue Mar 14, 2023
5 tasks
@rhshadrach
Copy link
Member

A potential reason for this is so that np.swapaxes(df) works. See #57351. But I'm not sure that needs to be supported - why can't users just do df.T?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants