# Building tensor
V_High = np.array( [np.ones(N)] )
V_Low = np.array( [np.ones(N)] )
V_Close = np.array( [np.ones(N)] )
for i in range(M-1):
V_High = np.vstack((V_High, Database[i][t+Starting_index-N:t+Starting_index,1]))
V_Low = np.vstack((V_Low, Database[i][t+Starting_index-N:t+Starting_index,2]))
V_Close = np.vstack((V_Close, Database[i][t+Starting_index-N:t+Starting_index,3]))
x_t = np.stack( ( V_High, V_Low, V_Close), axis = 2 ) # Note: the dimension of x_t is M*N*Feature
x_t = x_t.reshape( 1, M, N, Feature) # for the input requirement of tensorflow
代碼運行到這里一直報錯:
File "c:\test_history.py", line 104, in Back_Test
V_High = np.vstack((V_High, Database[i][t+Starting_index-N:t+Starting_index,1]))
TypeError: list indices must be integers or slices, not tuple
請問各位大神該怎么解決這個問題啊
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/123818.html
上一篇:python讀取txt文本到串列
