Skip to content

rename_axis(None) now (0.24) does nothing. Previously it removed the axis name #25034

Closed
@tdpetrou

Description

@tdpetrou

Code Sample, a copy-pastable example if possible

In 0.23 rename_axis was able to remove the axis name like this:

>>> s = pd.Series([1, 2, 3])
>>> s = s.rename_axis('asdf')
>>> s
asdf
0    1
1    2
2    3
dtype: int64

>>> s.rename_axis(None)
0    1
1    2
2    3
dtype: int64

In 0.24, the mapper parameter is defaulted to None so this does not work. The only way to remove an axis label is to use del s.index.name or s.index.name = None

Problem description

Seems like a regression. I have some code that relies on axis name removal with s.rename_axis(None). Seems like there is no clean way to remove an axis name now.

Expected Output

s.rename_axis(None) should work as it did in 0.23.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions