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
In [2]: df=pd.DataFrame([[1,2], [3,4]], index=pd.MultiIndex.from_product([['a', 'b'], ['c']]))
In [3]: df.loc['all'] = [5,6]
In [4]: dfOut[4]:
01
(a, c) 12
(b, c) 34all56
The conversion happens in concat. Is this expected?
I would have probably had a preference for concat transforming the flat index in the first level of a MultiIndex... but definitely not strong enough to change the current behavior of concat, so I would take another path to fix the above (maybe the one followed by the column case, which works?)
Code Sample, a copy-pastable example if possible
Problem description
From #16599 (comment)
In general, scalar labels are accepted as valid keys for
MultiIndex
es and automatically transformed to(key, '')
. Compare toExpected Output
Output of
pd.show_versions()
pandas: 0.21.0.dev+265.g9e7666dae
pytest: 3.0.6
pip: 9.0.1
setuptools: None
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
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: 3.7.1
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: