错误总结
错误总结
… object is not subscriptable
TypeError Traceback (most recent call last)
<ipython-input-216-ca85a32d972d> in <module>
12 return -1
13 return 0
---> 14 profit(pd.to_datetime('2018-01-06'))
<ipython-input-216-ca85a32d972d> in profit(mdate)
6 today = pfyh['date'].iloc[-1]
7 yesday = pfyh['date'].iloc[-2]
----> 8 tma5,tma10,yma5,yma10=today['ma5'],today['ma10'],yesday['ma5'],yesday['ma10']
9 if (yma10>yma5) and (tma10<=tma5):
10 return 1
TypeError: 'Timestamp' object is not subscriptable
subscript:写在下面的;下标。时间戳对象不可下标化。
pfyh[‘date’]得到是时间戳,这个地方应当检查修改。