-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
precision issue with rolling_std #9420
Comments
I did the same tests and i confirm you are right. Pandas & Numpy std function return very different precisions.I think the problem doesn't only happen when there are repeated data, although it always occurs in this case. I only found your comment about this issue and have no idea about the reasons, sorry. |
This may have been fixed by #18481, but we would need a reproducible example otherwise. |
#27593 reproduces this. I don't think it's a bug. When you calculate the variance for each window in isolation, you can get an exact zero result in such a case. When you do a true rolling window calculation (as pandas does), you'll only get something very small in this case due to floating point issues. |
i tested
rolling_std
func with some real data (floating number with format x.xx). For a Series/DataFrame which contains let's say 5 continuous identical rows among several hundreds, therolling_std
could return a small number with 10^-7 scale instead exactly zero. this is probably a known issue which has not been officially documented. i'm just curious with the reason behind and why the std member func works better.The text was updated successfully, but these errors were encountered: