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

precision issue with rolling_std #9420

Closed
leo4183 opened this issue Feb 5, 2015 · 4 comments
Closed

precision issue with rolling_std #9420

leo4183 opened this issue Feb 5, 2015 · 4 comments

Comments

@leo4183
Copy link

leo4183 commented Feb 5, 2015

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, the rolling_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.

@porris1000
Copy link

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.

@kay1793
Copy link

kay1793 commented Mar 10, 2015

#8424 , #8326

@mroeschke
Copy link
Member

This may have been fixed by #18481, but we would need a reproducible example otherwise.

@ghost
Copy link

ghost commented Jul 28, 2019

#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.

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

4 participants