Skip to content

BUG: Series.rename(scalar, copy=False) still copies data #52540

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
wants to merge 1 commit into from

Conversation

dannyi96
Copy link
Contributor

@dannyi96 dannyi96 commented Apr 8, 2023

# 2) If inplace is False/not supplied(default case), then
# inplace is determined based on copy (opposite of copy)
if not inplace:
inplace = not copy
return self._set_name(index, inplace=inplace)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the gist of the issue is that _set_name ( in the else portion ) doesn't support copy param and solely relies on inplace param.
Hence the copy param supplied to rename is just ignored in this case.

Some possible solutions here would be -

  1. In the else portion, determine inplace based on copy ( in the case where inplace is False ) and then invoke _set_name
  2. Support copy and inplace in _set_name and change its implementation similar to rename

I guess approach 1 might work/be better ( subject to review )

@dannyi96
Copy link
Contributor Author

dannyi96 commented May 4, 2023

as discussed in #52450

The fact that renaming does a copy=False still makes a copy is a bug, though. I don't think there is a plan to fix it, as the copy keyword is going to be deprecated.

Hence am closing this PR

@dannyi96 dannyi96 closed this May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Series.rename(scalar, copy=False) still copies data
1 participant