BUG: loc/ix indexers with empty list key lose names of respective axes · Issue #6552 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
This issue was encountered when fixing #6536. It seems that .loc
indexer with empty list key seems to lose names of respective axes:
In [2]: pd.DataFrame(np.arange(9).reshape(3,3), columns=pd.Series(list('abc'), name='foobar')) Out[2]: foobar a b c 0 0 1 2 1 3 4 5 2 6 7 8
[3 rows x 3 columns]
In [3]: _2.iloc[:,[]] Out[3]: Empty DataFrame Columns: [] Index: [0, 1, 2]
[3 rows x 0 columns]
In [4]: _2.iloc[:,[]].columns.names Out[4]: FrozenList([u'foobar'])
In [5]: _2.loc[:,[]].columns.names Out[5]: FrozenList([None])
It's not important, but currently #6551 has two tests skipped because of this bug.