Skip to content

Clarify docs for MultiIndex drops and levels #40953

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 3 commits into from
Apr 20, 2021
Merged

Conversation

phofl
Copy link
Member

@phofl phofl commented Apr 14, 2021

I did something like this in the past but this got lost back then between prs.

@@ -4749,7 +4749,7 @@ def drop(
Remove rows or columns by specifying label names and corresponding
axis, or by specifying directly index or column names. When using a
multi-index, labels on different levels can be removed by specifying
the level.
the level. The now-unused levels remain in the MultiIndex._levels attribute.
Copy link
Member

Choose a reason for hiding this comment

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

I think it would actually be better to just link to https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html#defined-levels as you did in the original issue. I don't think it's great to advertise "private" attributes in the docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@mroeschke mroeschke added this to the 1.3 milestone Apr 20, 2021
@jreback jreback merged commit 95d2667 into pandas-dev:master Apr 20, 2021
@jreback
Copy link
Contributor

jreback commented Apr 20, 2021

thanks @phofl

yeshsurya pushed a commit to yeshsurya/pandas that referenced this pull request Apr 21, 2021
@phofl phofl deleted the 36227 branch April 21, 2021 20:40
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: using df.drop(labels=x, level='level_name') does not update df.index.levels
3 participants