I'm trying to calculate rolling window correlation following How to calculate Rolling Correlation with pandas?. I have a dataset with two columns and a datetime index.
+---------------------+---------------------+---------------------+
| | temperature_pair1 | temperature_pair2 |
|---------------------+---------------------+---------------------|
| 2019-04-16 09:06:00 | 22.69 | 22.69 |
| 2019-04-16 09:07:00 | 22.69 | 22.69 |
| 2019-04-16 09:08:00 | 22.69 | 22.69 |
| 2019-04-16 09:09:00 | 22.75 | 22.69 |
| 2019-04-16 09:10:00 | 22.69 | 22.69 |
| 2019-04-16 09:11:00 | 22.69 | 22.75 |
| 2019-04-16 09:12:00 | 22.75 | 22.75 |
| 2019-04-16 09:13:00 | 22.75 | 22.75 |
| 2019-04-16 09:14:00 | 22.75 | 22.75 |
| 2019-04-16 09:15:00 | 22.75 | 22.75 |
+---------------------+---------------------+---------------------+
I'm applying the same methods shown in the question, foi.temperature_pair1.rolling(window_size).corr(foi.temperature_pair2)
, but the resulting dataframe has values outside of the range [-1, 1]
. What exactly am I missing?