python - 错误消息 : replace with Series. 滚动(窗口=5).corr(其他=<系列>)

标签 python pandas correlation rolling-computation

我正在尝试查找列 ['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 )

关于python - 错误消息 : replace with Series. 滚动(窗口=5).corr(其他=<系列>),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46167165/

相关文章:

python - Pandas read_csv : Columns are being imported as rows

python - 如何计算两个数据集之间的斯 PIL 曼等级相关性

pandas - 使用 Pandas.rolling 计算滚动自相关

python - 在二维数组/矩阵中查找 k 个最高值的索引

python - 每个点使用一个带宽值的内核估计

python - 在 PyQt5 中,如何在 QTreeWidget 单元格内添加 QSpinBox?

python - Pandas 中产品的连续日期

python - 如何将数据帧与数组时间戳合并并根据数组的条件进行绘图?

python - 如何增加文本小部件的字体大小?

machine-learning - 剂量标准化有助于获得更好的相关性吗?