-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Closed
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesPeriodPeriod data typePeriod data type
Description
The asof docs state that the method should return the most recent label up to and including the passed label. For period indexes, this doesn't seem to be happening - if I supply a period of a weekend date to a weekday series, it returns the Monday, rather than the Friday.
If I do the same on a DatetimeIndex, it behaves as expected
In [50]:
dates
Out[50]:
<class 'pandas.tseries.period.PeriodIndex'>
[1990-05-07, ..., 2015-07-13]
Length: 6568, Freq: B
In [51]:
dates_ts=dates.to_timestamp()
dates_ts
Out[51]:
<class 'pandas.tseries.index.DatetimeIndex'>
[1990-05-07, ..., 2015-07-13]
Length: 6568, Freq: None, Timezone: None
In [52]:
dates.asof('2015-07-11')
Out[52]:
Period('2015-07-13', 'B')
In [53]:
dates_ts.asof('2015-07-11')
Out[53]:
Timestamp('2015-07-10 00:00:00')
Metadata
Metadata
Assignees
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesPeriodPeriod data typePeriod data type