Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected result from rolling_median when center = True #5549

Closed
jonblunt opened this issue Nov 19, 2013 · 1 comment
Closed

Unexpected result from rolling_median when center = True #5549

jonblunt opened this issue Nov 19, 2013 · 1 comment

Comments

@jonblunt
Copy link

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.

@jonblunt
Copy link
Author

found issue #3136 .Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant