Skip to content

Conversation

@mroeschke
Copy link
Member

@mroeschke mroeschke added the Window rolling, ewma, expanding label Aug 27, 2021
@mroeschke mroeschke added this to the 1.4 milestone Aug 27, 2021
arg2.columns = cast(MultiIndex, arg2.columns)
result.index = MultiIndex.from_product(
arg2.columns.levels + [result_index]
# GH 21157
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thi s is really confusing. you are matching the codes from the original? can you reindex?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add comment to what's going on here, but unfortunately can't reindex here.

This needs to act like a MultiIndex.product, but instead of taking the product of all original levels + result level independently, the original levels need too be treated like a group first before taking a product

@mroeschke mroeschke merged commit 6a5dd0f into pandas-dev:master Sep 7, 2021
@mroeschke mroeschke deleted the bug/mi_columns_rolling_corr branch September 7, 2021 05:18
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
* BUG: rolling.corr with MultiIndex columns

* Add commentary of fix

* Trigger CI

* Use from_arrays

* Consider reordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MultiIndex Window rolling, ewma, expanding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rolling correlation for DataFrame with MultiIndex columns broken in Pandas 0.23

2 participants