Closed
Description
s = pd.Series( range(10), index = pd.PeriodIndex(start = '2013-10-1', end = '2013-10-10', freq = 'D'))
pd.rolling_median(s,5, min_periods = 1)
2013-10-01 0.0
2013-10-02 0.5
2013-10-03 1.0
2013-10-04 1.5
2013-10-05 2.0
2013-10-06 3.0
2013-10-07 4.0
2013-10-08 5.0
2013-10-09 6.0
2013-10-10 7.0
Freq: D, dtype: float64
When center is specified we get Nans in the last window//2 positions
s = pd.Series( range(10), index = pd.PeriodIndex(start = '2013-10-1', end = '2013-10-10', freq = 'D'))
pd.rolling_median(s,5, min_periods = 1, center = True)
2013-10-01 1.0
2013-10-02 1.5
2013-10-03 2.0
2013-10-04 3.0
2013-10-05 4.0
2013-10-06 5.0
2013-10-07 6.0
2013-10-08 7.0
2013-10-09 NaN
2013-10-10 NaN
Freq: D, dtype: float64
I was expecting the last two values to be 7.5 and 8.
I got the same results, nans at the end with rolling_mean as well
This is with pandas 12.0 and windows 64.
Metadata
Metadata
Assignees
Labels
No labels