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

rename_axis inplace=True #15704

Closed
scottboston opened this Issue Mar 16, 2017 · 5 comments

Comments

Projects
None yet
4 participants
@scottboston

scottboston commented Mar 16, 2017

Code Sample, a copy-pastable example if possible

import pandas as pd
import numpy as np

df = pd.DataFrame({'a':np.random.random(10),'b':np.random.random(10)})
df
df.rename_axis('numbers', inplace=True)
df

Problem description

df.rename_axis with the inplace=True should return None and make the named axis change the index name in the original object. However, up listing df again, no index name is present.

Expected Output

df.index.name should return 'numbers'

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.5.2.final.0 python-bits: 64 OS: Linux OS-release: 4.4.0-66-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.1
statsmodels: 0.6.1
xarray: None
IPython: 5.1.0
sphinx: 1.4.6
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.1.0
tables: 3.2.3.1
numexpr: 2.6.1
matplotlib: 1.5.3
openpyxl: 2.3.2
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.3
lxml: 3.6.4
bs4: 4.5.1
html5lib: 0.999999999
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.42.0
pandas_datareader: 0.3.0.post

@TomAugspurger

This comment has been minimized.

Show comment
Hide comment
@TomAugspurger

TomAugspurger Mar 16, 2017

Contributor

Not supporting inplace was a deliberate decision in #11980
If you want to change it inplace use df.index.name = name.

We could raise an exception if your renaming the axis label and inplace is true, rather than silently ignoring. Mind submitting a PR to fix that?

Contributor

TomAugspurger commented Mar 16, 2017

Not supporting inplace was a deliberate decision in #11980
If you want to change it inplace use df.index.name = name.

We could raise an exception if your renaming the axis label and inplace is true, rather than silently ignoring. Mind submitting a PR to fix that?

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Mar 16, 2017

Contributor

could support inplace as well, not a big deal (and we are already way down that road :<)

Contributor

jreback commented Mar 16, 2017

could support inplace as well, not a big deal (and we are already way down that road :<)

@jreback jreback modified the milestones: 0.20.0, Next Major Release Mar 23, 2017

@HndrkMkt HndrkMkt referenced this issue May 25, 2017

Merged

Add inplace support for rename_axis #16505

3 of 3 tasks complete
@gfyoung

This comment has been minimized.

Show comment
Hide comment
@gfyoung

gfyoung May 28, 2017

Member

@jreback :

and we are already way down that road

Perhaps there will be a time when we can start deprecating inplace ? (Or rather, why do we want to go further down that road). 😄

Member

gfyoung commented May 28, 2017

@jreback :

and we are already way down that road

Perhaps there will be a time when we can start deprecating inplace ? (Or rather, why do we want to go further down that road). 😄

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback May 28, 2017

Contributor

Perhaps there will be a time when we can start deprecating inplace ? (Or rather, why do we want to go further down that road). 😄

pandas 2 will not support inplace

i suppose u can make an issue about deprecating it (at least DeprecationWarning) and see what reactions it brings

Contributor

jreback commented May 28, 2017

Perhaps there will be a time when we can start deprecating inplace ? (Or rather, why do we want to go further down that road). 😄

pandas 2 will not support inplace

i suppose u can make an issue about deprecating it (at least DeprecationWarning) and see what reactions it brings

@gfyoung

This comment has been minimized.

Show comment
Hide comment
@gfyoung

gfyoung May 29, 2017

Member

That's fair. I don't see why we shouldn't try deprecating.

xref #16529

Member

gfyoung commented May 29, 2017

That's fair. I don't see why we shouldn't try deprecating.

xref #16529

@jreback jreback modified the milestones: 0.21.0, Next Major Release Jun 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment