Lets say I have 3 variables A, B and C for a long period of time. I can get a correlation matrix in pandas for a window of first 3 days simply by using .corr()
A B C
23/2/2017 21.93 4.48 13.27
24/2/2017 2.65 10.18 11.95
25/2/2017 8.74 10.67 6.30
26/2/2017 6.88 10.26 8.40
27/2/2017 12.20 9.56 12.82
28/2/2017 8.12 9.54 2.67
A B C
A 1
B -0.93 1
C 0.38 -0.70 1
This matrix can also be presented in table form:
(A,B) (B,C) (C,A)
23/2/2017 NaN NaN NaN
24/2/2017 NaN NaN NaN
25/2/2017 -0.93 -0.70 0.38
What i need is a rolling window of 3 days with pairwise correlations populated like the table form above. I understand there's the pd.corring_corr(pairwise=True) function, just haven't got a clue how to obtain in a table format, with all possible combinations as columns.
Appreciate if anyone can help. Thanks!