Skip to content

Inconsistent name for keyword that determines whether new object is generated #5769

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
8one6 opened this issue Dec 24, 2013 · 4 comments
Closed

Comments

@8one6
Copy link

8one6 commented Dec 24, 2013

If I understand this right, the syntax is:

df.sort_index(..., inplace=False)

but is

df.reindex_axis(..., copy=True)

Any reason why we shouldn't just use the same keyword (either copy or inplace) in all functions to determine whether to modify the original object or make a new one?

@jtratner
Copy link
Contributor

I understand your point. To be clear, right now reindex_axis is written such that it always returns an object. So inplace would actually be new functionality (i.e. keeping data with the original object reference). Also, when copy=False, there's no guarantee that a copy isn't made, copy means "force copy" here.

From the docs on reindex_axis:

copy : boolean, default True
Return a new object, even if the passed indexes are the same

sort_index always makes a copy of the underlying data.

@jtratner
Copy link
Contributor

I believe the rationale for that is that you might use reindex_axis to perform alignment first, then manipulate the object, so you might not want to get a copy if it turns out that both objects are actually indexed with the exact same Index object.

@jreback
Copy link
Contributor

jreback commented Jan 25, 2014

this would cause a lot of API changes..pushing to someday

@mroeschke
Copy link
Member

reindex_axis has been deprecated and removed. Closing

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

4 participants