用python的statsmodels做预测时遇到问题,用Yahoo拉到的数据用forecast()预测只能预测之前的数据,没办法只能把pandas数组逆序,再做预测。
s = Series([4, 7, -5, 3], index=['1','2','3','4'])
1 4 2 7 3 -5 4 3 dtype: int64
s2 = s.sort_index(ascending=False)
4 3 3 -5 2 7 1 4 dtype: int64原来是升序的就False,原来是降序的就True。