Skip to content

REGR: empty list selection resets index types #7774

Closed
@jreback

Description

@jreback

regression from 0.14.0 (which return Index, which is also not correct).

iloc DOES work correctly though

In [9]: df = tm.makeTimeDataFrame()

In [10]: df.index
Out[10]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-03, ..., 2000-02-11]
Length: 30, Freq: B, Timezone: None

In [11]: df.loc[[]].index
Out[11]: Float64Index([], dtype='float64')

# this is the correct result
In [4]: df.iloc[[]].index
Out[4]: 
<class 'pandas.tseries.index.DatetimeIndex'>
Length: 0, Freq: None, Timezone: None
In [7]: p = tm.makePanel()

In [8]: p.major_axis
Out[8]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-03, ..., 2000-02-11]
Length: 30, Freq: B, Timezone: None

In [9]: p.loc[:,[],:].major_axis
Out[9]: Float64Index([], dtype='float64')

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingRelated to indexing on series/frames, not to indexes themselvesRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions