Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
Often when working with DataFrame multi-indexes, I end up with one index level that needs to be renamed. This is something I routinely face after stack/unstack, pivot, concat, and groupby operations.
Currently, we can use .rename_axis()
with a mapping or list, but neither solution lets me pick an index level by position and rename it, which is useful if I have more than one unnamed or incorrectly-named level. You can also assign to .index.names
, but you have the same issue there, because .index.names
is generally immutable.
Feature Description
I am not sure about implementation. Ideally it would use the same internal dispatch mechanisms as the rest of
Alternative Solutions
As far as I can tell, the alternative solution is to do nothing. I don't see a sensible alternative that fits in with the Pandas API design.
Additional Context
This has been asked about at least once on StackOverflow: https://stackoverflow.com/q/70812332/2954547