Skip to content

BUG: rolling().corr() crash with time period #62937

@kostayScr

Description

@kostayScr

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

import numpy as np
import pandas as pd

dateRange = pd.date_range("2000-1-1", "2010-1-1", 200000)
dateRange2 = dateRange[::33]
src = pd.DataFrame( columns={"0": np.random.normal(size=6000)}, index=dateRange2 )
arg = pd.Series(np.random.normal(size=200000), index=dateRange)
print(src)
print(arg)

for i in range(100):
    src.iloc[:, 0].rolling("100D").corr(arg)
    #src.iloc[:, 0].rolling(10000).corr(arg) #no crash

Issue Description

Rolling corr with wrong dimensions causes a crash, not a python exception.

Expected Behavior

Python exception or some result.

Installed Versions

INSTALLED VERSIONS

commit : 9c8bc3e
python : 3.13.3
python-bits : 64
OS : Windows
OS-release : 10

pandas : 2.3.3
numpy : 2.3.4
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSegfaultNon-Recoverable ErrorWindowrolling, ewma, expanding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions