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

ENH: To add an inplace option for pd.DataFrame.reindex #60199

Closed
1 of 3 tasks
blue-cat-whale opened this issue Nov 5, 2024 · 2 comments
Closed
1 of 3 tasks

ENH: To add an inplace option for pd.DataFrame.reindex #60199

blue-cat-whale opened this issue Nov 5, 2024 · 2 comments

Comments

@blue-cat-whale
Copy link

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

I wish I could update the index of a dataframe inplace.

Feature Description

Functions pd.DataFrame.set_index() and pd.DataFrame.reset_index() both have an option of inplace=True. I hope function pd.DataFrame.reindex() add it as well. This might lead to adding another option of drop=True.

Alternative Solutions

N/A

Additional Context

No response

@blue-cat-whale blue-cat-whale added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 5, 2024
@jorisvandenbossche
Copy link
Member

Given that we are planning to remove the inplace keyword in most cases (see #51466, rendered view of the PDEP at https://jorisvandenbossche.github.io/pandas-website-preview/pdeps/0008-inplace-methods-in-pandas.html), I think we won't add it in new places.

Specifically for reindex, this is an example of method that in practice can never be done in-place, so the inplace=True option would just be the same as doing df = df.reindex(..) under the hood.

@jorisvandenbossche jorisvandenbossche added Closing Candidate May be closeable, needs more eyeballs and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 5, 2024
@WillAyd
Copy link
Member

WillAyd commented Nov 11, 2024

Agree with @jorisvandenbossche here - we have been moving away from this API

@jorisvandenbossche jorisvandenbossche removed the Closing Candidate May be closeable, needs more eyeballs label Nov 12, 2024
@jorisvandenbossche jorisvandenbossche closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants