-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
BugMultiIndexRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas versionWindowrolling, ewma, expandingrolling, ewma, expanding
Milestone
Description
Code Sample
import numpy as np
import pandas as pd
index = range(5)
data = np.random.random(size=(len(index), 2))
simple_cols = ['M', 'N']
simple_df = pd.DataFrame(data, index=index, columns=simple_cols)
multi_cols = pd.MultiIndex.from_arrays([['M', 'N'], ['P', 'Q']], names=['a', 'b'])
multi_df = pd.DataFrame(data, index=index, columns=multi_cols)
# Works:
simple_df.rolling(3).corr()
# Fails
multi_df.rolling(3).corr()
Problem description
Since the Pandas 0.23 release it is no longer possible to calculate rolling correlation on a pd.DataFrame which has a pd.MultiIndex column index. An exception is raised in 0.23. In 0.22 a valid rolling correlation result is returned.
Expected Output
Pandas should return the same rolling correlation matrix as it returns for a data frame with simple index, but with the multi index levels in columns and index as they appeared in 0.22.
hafsaBen
Metadata
Metadata
Assignees
Labels
BugMultiIndexRegressionFunctionality that used to work in a prior pandas versionFunctionality that used to work in a prior pandas versionWindowrolling, ewma, expandingrolling, ewma, expanding