Created
October 24, 2012 18:46
-
-
Save mrjbq7/3948013 to your computer and use it in GitHub Desktop.
pandas bug: rolling_sum and rolling_mean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas | |
data = np.load('data.npy') | |
assert all(data >= 0) | |
sums = pandas.rolling_sum(data, 2, min_periods=1) | |
zero = np.where(sums < 0)[0] | |
assert len(zero) == 0, zero | |
mean = pandas.rolling_mean(data, 2, min_periods=1) | |
zero = np.where(mean < 0)[0] | |
assert len(zero) == 0, zero |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment