You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apparently, the level argument works only for relabeling, not for renaming the level. This is not, however, mentioned in the docs.
This is closely related to #14829 (that is: whatever will the new method for index renaming be called, it will need not just to steal the related logics from .rename, but also to implement this one, which is currently absent).
Expected Output
Same as
In [4]: df=pd.DataFrame([[1], [2]], index=mi)
In [5]: df.index.names= ['a', 'c']
In [6]: dfOut[6]:
0ac121342
@toobaz : I'm a little confused by what you're doing here. According to the docs, you should not be passing in a scalar for the index parameter when using a DataFrame:
Scalar or list-like will alter the Series.name attribute, and raise on DataFrame or Panel
Sorry, you are right. I got confused. I expected rename to allow me to rename the index, but it just doesn't do this, regardless of the index being flat or not.
Code Sample, a copy-pastable example if possible
Problem description
Apparently, the
level
argument works only for relabeling, not for renaming the level. This is not, however, mentioned in the docs.This is closely related to #14829 (that is: whatever will the new method for index renaming be called, it will need not just to steal the related logics from
.rename
, but also to implement this one, which is currently absent).Expected Output
Same as
Output of
pd.show_versions()
pandas: 0.21.0.dev+310.ge3b784068
pytest: 3.0.6
pip: 9.0.1
setuptools: None
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
pyarrow: None
xarray: None
IPython: 5.1.0.dev
sphinx: 1.5.6
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.3.0
numexpr: 2.6.1
feather: 0.3.1
matplotlib: 2.0.2
openpyxl: None
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.6
lxml: None
bs4: 4.5.3
html5lib: 0.999999999
sqlalchemy: 1.0.15
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: 0.2.1
The text was updated successfully, but these errors were encountered: