You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be a precision problem with rolling.std(). Including more data in the pd.Series affects noticeably the result of calculations that are quite far apart (several times the rolling window). I think it may be an error introduced by the online algorithm that is used.
Thanks! I did see the ~1e-15 error for variance but thought it wasn't exactly for the same reason given the difference in the order of magnitude (i.e., I didn't realise ~1e-15 in variance is equivalent to ~1e-8 in std).
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
There seems to be a precision problem with rolling.std(). Including more data in the pd.Series affects noticeably the result of calculations that are quite far apart (several times the rolling window). I think it may be an error introduced by the online algorithm that is used.
Related:
#37055
#37051
#39872
Expected Behavior
print(data.rolling(5).std().iloc[-1])
The above should yield 0 as the 5 last data points are equal.
Installed Versions
INSTALLED VERSIONS
commit : 06d2301
python : 3.8.12.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18363
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : es_ES.cp1252
pandas : 1.4.1
numpy : 1.21.5
pytz : 2021.3
dateutil : 2.8.2
pip : 20.3.3
setuptools : 58.0.4
Cython : None
pytest : 7.0.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.2
IPython : 7.31.1
pandas_datareader: None
bs4 : None
bottleneck : 1.3.2
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.5.1
numba : 0.55.1
numexpr : 2.8.1
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
sqlalchemy : 1.3.24
tables : None
tabulate : 0.8.9
xarray : None
xlrd : None
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: