BUG: resample with TimedeltaIndex, fenceposts are off · Issue #13022 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
brought up in #12925
some examples in #15167
Resampling fence posts are off when upsampling < 1 Day.
In [5]: df = DataFrame(data=[[1, 3], [-5, 10], [0, 0]],index=pd.timedelta_range('00:00:00','00:10:00',freq='5T'))
In [6]: df.resample('1T').asfreq()
Out[6]:
0 1
00:00:00 1.0 3.0
00:01:00 NaN NaN
00:02:00 NaN NaN
00:03:00 NaN NaN
00:04:00 NaN NaN
00:05:00 -5.0 10.0
00:06:00 NaN NaN
00:07:00 NaN NaN
00:08:00 NaN NaN
00:09:00 NaN NaN
In [8]: df.resample('1T').mean()
Out[8]:
0 1
00:00:00 1.0 3.0
00:01:00 NaN NaN
00:02:00 NaN NaN
00:03:00 NaN NaN
00:04:00 NaN NaN
00:05:00 -5.0 10.0
00:06:00 NaN NaN
00:07:00 NaN NaN
00:08:00 NaN NaN
00:09:00 NaN NaN
00:10:00 0.0 0.0