Home > other >  Python is a small white would like to ask about a np. Vstack problem
Python is a small white would like to ask about a np. Vstack problem

Time:10-11

# 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 Feature x_t is M * N *
X_t=x_t. Reshape (1, M, N, Feature) # for the input requirement of tensorflow

Code to run here has been an error:
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 a tuple

Excuse me each great god how to solve this problem
  • Related