Pythonで学ぶ時系列解析
Rob Reider
Adjunct Professor, NYU-Courant Consultant, Quantopian



df の日次 $\yen$/$ 為替レートを使用# Convert index to datetime df.index = pd.to_datetime(df.index)# Downsample from daily to monthly data df = df.resample(rule='M').last()# Compute returns from prices df['Return'] = df['Price'].pct_change()# Compute autocorrelation autocorrelation = df['Return'].autocorr() print("The autocorrelation is: ",autocorrelation)
The autocorrelation is: 0.0567
Pythonで学ぶ時系列解析