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

BUG: scipy rolling exponential is breaking MultiIndex columns #58714

Closed
2 of 3 tasks
epizut opened this issue May 14, 2024 · 2 comments
Closed
2 of 3 tasks

BUG: scipy rolling exponential is breaking MultiIndex columns #58714

epizut opened this issue May 14, 2024 · 2 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@epizut
Copy link

epizut commented May 14, 2024

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.

Issue Description

Adding win_type='exponential' to a rolling function drops the first column level.

Reproducible Example

import numpy as np
import pandas as pd

df = pd.DataFrame(
        index=pd.date_range('2024-01-01', periods=1),
        columns=pd.MultiIndex.from_product([('A', 'B'), ('a', 'b')])
    )
# the input multi-index column df
df

image

# the broken output with a missing first column level
df.rolling(5, min_periods=2, win_type='exponential').mean()

image

Expected Behavior

.rolling(...).mean(...) should always keep the original indexes.
image

Installed Versions

pandas==2.2.2
scipy==1.13.0

INSTALLED VERSIONS ------------------ commit : d9cdd2e python : 3.12.3.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : Intel64 Family 6 Model 106 Stepping 6, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_United States.1252

pandas : 2.2.2
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
setuptools : None
pip : 24.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
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.13.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None

@epizut epizut added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 14, 2024
@Aloqeely
Copy link
Member

Thanks for the report. This is fixed on the main branch

@epizut
Copy link
Author

epizut commented May 15, 2024

Thank you for checking that.

@epizut epizut closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants