Create rolling covariance matrix in pandas
问题 I am trying to create a set of rolling covariance matrices on financial data (window size = 60). Returns is a 125x3 df. import pandas as pd roll_rets = returns.rolling(window=60) Omega = roll_rets.cov() Omega is a 375x3 data frame with what looks like a multi-index - i.e. there are 3 values for each timestamp. What I actually want this to return is a set of 66 3x3 covariance matrices (i.e. one for each period), but I can't work out how to iterate over returns correctly to do this. I think I'm