错误消息:替换为 Series.rolling(window=5).corr(other=<Series>)

Error Msg: replace with Series.rolling(window=5).corr(other=<Series>)

我试图找到列 ['High'] 和 ['Low'] 之间 5 个周期的滚动相关性。

我算出来了,但是有一个错误:

FutureWarning: pd.rolling_corr is deprecated for Series and will be removed in a future version, replace with Series.rolling(window=5).corr(other=)

尝试更换它但没有用。有帮助吗?

import pandas as pd
df_Gold = pd.read_csv('GoldData.csv')
df_Gold['High_Low'] = pd.rolling_corr(df_Gold['High'],df_Gold['Low'],5)
print(df_Gold.tail())

尝试使用

df['Col1'].rolling(5).corr(df['Col2'])#pandas V 0.20

通知

pd.rolling_corr(df['Col1'],df['Col2'],window=5)#panda V 0.17 (notice pd.rolling_corr is deprecated for Series )