2017-09-12 8 views
1

と置き換えてください。['High']と['Low']列の間に5つの周期のローリング相関を見つけることを試みています。エラーメッセージ:Series.rolling(window = 5).corr(他= <Series>)

私はそれを計算するために管理しますが、エラーがあります:

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

は、それを交換しようとしたが、それは仕事をdoesntの。どんな助け?

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()) 
+0

http://pandas.pydata.org/pandas-docs/version/0.17.0/を使用してみてください生成/ pandas.rolling_corr.html – Wen

答えて

1

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) 
+0

それはすごく感謝します! : df_Gold ['High_Low'] = df_Gold ['High']ローリング(5).corr(df_Gold ['Low']) – NewCoder

+0

@NewCoder Gald it help〜:) – Wen

関連する問題