-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
rolling_cov and rolling_corr error out when len(series) < min_periods #7764
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
Comments
cc @seth-p IIRC the changes were made only in |
@creeson I believe that the exception is correct, and that the rest of the |
I don't think my changes in 14.1 (#7604) affected this. I didn't touch the treatment of Separately, I don't like the way |
Thanks guys. Is it considered more pythonic to error out? Otherwise I strongly prefer the behavior of letting the code continue with NaNs, after all, if you are using min_periods, you expect to get at least some NaNs. And I'm not at my work machine now, but I am 99% sure I can avoid this error by adding dummy NaNs to the beginning and removing them afterwards, which doesn't make any sense to me. But please let me know if there is some obvious downside to letting the code continue with NaNs? |
I think the observed 14.1 behavior of Actually, only difference I can see is that when Am happy to submit a PR to eliminate |
well we should decide which is more correct and make it consistent if u both would investigate pros/cons would be great |
I think it would be most consistent to eliminate the |
FWIW, I just submitted a pull request. Though for some reason the Travis build failed (https://travis-ci.org/pydata/pandas/jobs/30036354) in a way that seems unrelated to my changes. (I had no problems running tests on my local 3.4.1 setup.) |
I rebased #7766, and now it builds successfully. |
I updated #7766 to test all |
closed by #7766 |
I am updating a codebase from an OLD version of pandas (0.7.3) to current version (0.14.1) in python 2.7.
Not sure if this is properly classified as a bug, or if it is an expected code change. However, it seems rolling_cov / rolling_corr are specifying the window as min(window given, max(len(arg1), len(arg2)), and then erring out if arg1 AND arg2 are shorter than min_periods. Before, we would just get NaNs back.
Here is some test code:
In 0.14.1:
In 0.7.3:
Note that changing either s1 OR s2 to be 6, the code doesn't error out, and instead outputs:
Meanwhile, in 0.14.1, other rolling functions continue to behave as before:
Outputs:
The text was updated successfully, but these errors were encountered: