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
However the last line is wrong. The alternating 1/0 sequence, when in a window of size 5 (i.e. either 10101 or 01010), should have a variance of 0.24 when the weight is either all equal or linear decay (feel free to verify this). This means the last 3 prints should all generate
but it's not the case as the elments in the last line are pretty off 0.24 - the first non-Nan value is close enough, but the four numbers after that are pretty off.
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
The 4 prints of the code snippet generates the following
However the last line is wrong. The alternating 1/0 sequence, when in a window of size 5 (i.e. either
10101
or01010
), should have a variance of 0.24 when the weight is either all equal or linear decay (feel free to verify this). This means the last 3 prints should all generatebut it's not the case as the elments in the last line are pretty off 0.24 - the first non-Nan value is close enough, but the four numbers after that are pretty off.
Expected Behavior
should be
or something really close to that
Installed Versions
INSTALLED VERSIONS
commit : 0f43794
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-1042-azure
Version : #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.0.3
numpy : 1.21.5
pytz : 2022.1
dateutil : 2.8.2
setuptools : 59.6.0
pip : 22.0.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.8.0
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.31.1
pandas_datareader: None
bs4 : 4.10.0
bottleneck : None
brotli : 1.0.9
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
Note the issue is also there if you use the latest version of
numpy
andscipy
(which are1.25.2
and1.11.1
respectively as of filing)The text was updated successfully, but these errors were encountered: