Skip to content

Fix variable copy with multi-index #881

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

Merged
merged 2 commits into from
Jun 16, 2016

Conversation

benbovy
Copy link
Member

@benbovy benbovy commented Jun 13, 2016

Fixes #769.

if isinstance(self._data, PandasIndexAdapter):
# there is no need to copy the index values here even if deep=True
# since pandas.Index objects are immutable
data = PandasIndexAdapter(self) if deep else self._data
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need these two different code paths? Why not always return self._data in this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

I saw this in Coordinate.copy() so I thought there might have some wrapper data to copy in PandasIndexAdapter but I admit I didn't checked it.

Indeed, now that I see why we have this in Coordinate.copy() I don't see any reason to have these two different code paths here.

@shoyer shoyer merged commit 065ea6a into pydata:master Jun 16, 2016
@shoyer
Copy link
Member

shoyer commented Jun 16, 2016

Thanks!

@benbovy benbovy mentioned this pull request Jul 19, 2016
@benbovy benbovy deleted the multi-index_fix-copy branch August 1, 2016 14:17
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.

2 participants