Skip to content

Add method to change the .name attribute on the axes #11965

Closed
@wcbeard

Description

@wcbeard

It would be nice to have a method to change the .name attribute on the columns/index, to permit it in a method chain. (This is a suggestion based on this stackoverflow question.)

Instead of

df.columns.name = 'A'
df.index.name = 'B'
df
    A   0   1
    B        
    0   9   4
    1  15   0
    2  17  16

it would allow something like

df.rename_columns('A').rename_index('B')

or perhaps be a keyword argument to the existing .rename(). Does this seem like something that would fit in with pandas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions