Code Sample, a copy-pastable example if possible

import pandas as pd
df = pd.DataFrame({'Column 1'     : [1., 2., 3., 4.],
        'Index Title'  : ["Apples", "Oranges", "Puppies", "Ducks"]})
print df.axes

d2 = df.rename_axis('mycols', axis=1, inplace = True)
print d2
print df

Problem description

When trying to change the name of an axis using df.rename_axis, the inplace=True option should work but does nothing. The original DataFrame is unchanged. I get:

[RangeIndex(start=0, stop=4, step=1), Index([u'Column 1', u'Index Title'], dtype='object')]
mycols  Column 1 Index Title
0            1.0      Apples
1            2.0     Oranges
2            3.0     Puppies
3            4.0       Ducks
   Column 1 Index Title
0       1.0      Apples
1       2.0     Oranges
2       3.0     Puppies
3       4.0       Ducks

Expected Output

d2 and df should end up with the same values in my example.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None python: 2.7.14.final.0 python-bits: 64 OS: Linux OS-release: 4.13.0-22-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_CA.UTF-8 LOCALE: en_CA.UTF-8

pandas: 0.20.3 pytest: None pip: 9.0.1 setuptools: 36.4.0 Cython: 0.24 numpy: 1.13.3 scipy: 0.17.0 xarray: None IPython: 5.4.1 sphinx: None patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: 2.0.2 openpyxl: None xlrd: 1.1.0 xlwt: None xlsxwriter: None lxml: None bs4: 4.6.0 html5lib: 0.999999999 sqlalchemy: 1.1.14 pymysql: None psycopg2: 2.7.3 (dt dec mx pq3 ext lo64) jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: None

Comment From: jreback

in 0.22 works ok. FYI using inplace=True AND returning a value is completely non-idiomatic. In fact your df2is actually None.

In [2]: df
Out[2]: 
   Column 1 Index Title
0       1.0      Apples
1       2.0     Oranges
2       3.0     Puppies
3       4.0       Ducks

In [3]: df.rename_axis('mycols', axis=1, inplace = True)

In [4]: df
Out[4]: 
mycols  Column 1 Index Title
0            1.0      Apples
1            2.0     Oranges
2            3.0     Puppies
3            4.0       Ducks