在学习Harrison的股票分析时,按照H神的代码运行时报错了。错误信息为:
'numpy.int64' object has no attribute 'timestamp'
这是由于股票数据是按时间作为index的,但是直接读取数据,是无法将data列作为index的,所以在pandas读取数据时,要设置下,代码如下所示:
df = pd.read_csv('google.csv',
index_col='Date',
parse_dates=True)
这样就可以了。