I want to calculate corr between two series. I defined them as:
s = pd.Series([1,2,3,4,5,6,7])
s2 = pd.Series([2,3,4])
what i want is a correlation series, that the values is the corr between s.rolling(3) with s2
For example: the first element of result should be [1,2,3].corr(s2), the second should be [2,3,4].corr(s2), .....
I read the usage example of rolling, but i think it inner method rolling(3).corr cant solve this, is there any good methods to do this?