Skip to content

PeriodIndex slicing by datetime fails when either end out-of-bounds #1977

@ijmcf

Description

@ijmcf

pi = pandas.PeriodIndex(start='2012-01-01', periods=10, freq='W-MON')
ts = pandas.TimeSeries(range(len(pi)), index=pi)

dt1 = datetime.datetime(2011, 10, 2)
dt2 = datetime.datetime(2012, 1, 2)
dt3 = datetime.datetime(2012, 2, 10)
dt4 = datetime.datetime(2012, 4, 20)

ts[dt2: dt3]
ts[dt1: dt3]
ts[dt2: dt4]

The first slice works, the second and third do not. It looks like the code that handles 'out-of-bounds' slices is failing in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions