2017-09-12 17 views
1

열 [ '높음']과 [ '낮음'] 사이에 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=)

는하지만 작품을 나던. 어떤 도움이 필요합니까?

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/ generated/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 [ '높음'] 롤링 (5) .corr (df_Gold [ '낮음']) – NewCoder

+0

@NewCoder Gald it help ~ :) – Wen