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

Return view for xs when droplevel=False with regular Index #37832

Merged
merged 3 commits into from
Nov 15, 2020

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 14, 2020

Is there a better way to test, if the object is a view?

cc @jbrockmendel

@phofl phofl mentioned this pull request Nov 14, 2020
5 tasks
@phofl phofl added the Indexing Related to indexing on series/frames, not to indexes themselves label Nov 14, 2020
# GH#37832
df = DataFrame([[1, 2, 3]], columns=Index(["a", "b", "c"]))
result = df.xs("a", axis=1, drop_level=False)
df["a"] = 2
Copy link
Member

Choose a reason for hiding this comment

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

this is tricky, better to do the set on df.values to be on the safe side

Copy link
Member Author

Choose a reason for hiding this comment

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

Thx, done

@jbrockmendel
Copy link
Member

thanks for following up on this

Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

LGTM

@jreback jreback added this to the 1.2 milestone Nov 15, 2020
@jreback jreback merged commit 1ee2bda into pandas-dev:master Nov 15, 2020
@jreback
Copy link
Contributor

jreback commented Nov 15, 2020

thanks @phofl

@phofl phofl deleted the xs_view branch December 10, 2021 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants