我只是在学习Python,这段代码似乎很简单。但是,即使四处搜寻,我也无法弄清楚如何解决此问题。有什么建议吗?谢谢!
%matplotlib inline
import pandas as pd
def get_returns(file):
'''This function get_data reads a data file from disk
and returns percentage returns.'''
return pd.read_csv( file + '.csv', index_col=0, parse_dates=True).pct_change()
df = get_returns('ABC_Example')
df['AAPL'] = get_returns('AAPL_Example')
df['ABC'].rolling(50).corr(df['AAPL'])[-200].plot()
AttributeError:“ numpy.float64”对象没有属性“ plot”