BUG: Series rolling .var with window>14, center=True, and any win_type crashes python with no error message · Issue #46760 · pandas-dev/pandas (original) (raw)

Pandas version checks

Reproducible Example

import pandas as pd

""" Crash occurs often when: window >= 15, center=True, win_type='triang' (or any win_type AFAIK), usually in the first few trials.

Crash does not result in an error message, python just quits.

Crash does not occur when: window <= 14 win_type is not specified center=False .var() is changed to .mean() """

x = pd.Series(0)

N = 10

for i in range(N): print('Starting trial %s out of %s...' % (i+1,N), end='') result = x.rolling(window=16, center=True, win_type='triang').var() print('success')

Issue Description

This script, if executed, causes python to simply stop (as if calling quit()) ~3/4ths of the time, usually when i > 1.

Crash seems to occur often when:

Crash does not seem to occur when:

Example of repeatedly running the script:

>>python module1.py
Starting trial 1 out of 10...success
Starting trial 2 out of 10...success
Starting trial 3 out of 10...success
Starting trial 4 out of 10...success

>>python module1.py
Starting trial 1 out of 10...success
Starting trial 2 out of 10...success
Starting trial 3 out of 10...success

>>python module1.py
Starting trial 1 out of 10...success
Starting trial 2 out of 10...success
Starting trial 3 out of 10...success
Starting trial 4 out of 10...success
Starting trial 5 out of 10...success
Starting trial 6 out of 10...success
Starting trial 7 out of 10...success
Starting trial 8 out of 10...success
Starting trial 9 out of 10...success
Starting trial 10 out of 10...success

Expected Behavior

The script should run reliably, or at least deterministically.

An error should appear if there is an issue, but instead python appears to just quit()/crash without any message.

Installed Versions

INSTALLED VERSIONS

commit : 4bfe3d0
python : 3.10.4.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19044
machine : AMD64
processor : AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252

pandas : 1.4.2
numpy : 1.22.3
pytz : 2022.1
dateutil : 2.8.2
pip : 22.0.4
setuptools : 58.1.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
markupsafe : None
matplotlib : None
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
xlwt : None
zstandard : None