numpy array:tuple 索引超出范围
numpy array:tuple index out of range
#converting the lists into numpy arrays
x_train=np.array(x_train)
x_test=np.array(x_test)
y_train=np.array(y_train)
y_test=np.array(y_test)
x_train.shape,x_test.shape,y_train.shape,y_test.shape
the problem starts from below code
整形为 2d 以保存为 csv 格式
x_train_2d=np.reshape(x_train,(x_train.shape[0],x_train.shape[1]*x_train.shape[2]))
x_test_2d=np.reshape(x_test,(x_test.shape[0],x_test.shape[1]*x_test.shape[2]))
x_train_2d.shape,x_test_2d.shape
大概你能做的就是下面这些。
创建包含列 40 values from second dimension of X, and Y value
的 csv 文件
行将首先是训练数据,然后是测试数据
data_train = np.c_[x_train, y_train]
data_test = np.c_[x_test, y_test]
data = np.r_[data_train, data_test]
print(data.shape)
np.savetxt('filename.csv', data, delimiter=',')
输出数据形状将为
(8732, 41)
#converting the lists into numpy arrays
x_train=np.array(x_train)
x_test=np.array(x_test)
y_train=np.array(y_train)
y_test=np.array(y_test)
x_train.shape,x_test.shape,y_train.shape,y_test.shape
the problem starts from below code
整形为 2d 以保存为 csv 格式
x_train_2d=np.reshape(x_train,(x_train.shape[0],x_train.shape[1]*x_train.shape[2]))
x_test_2d=np.reshape(x_test,(x_test.shape[0],x_test.shape[1]*x_test.shape[2]))
x_train_2d.shape,x_test_2d.shape
大概你能做的就是下面这些。
创建包含列 40 values from second dimension of X, and Y value
的 csv 文件
行将首先是训练数据,然后是测试数据
data_train = np.c_[x_train, y_train]
data_test = np.c_[x_test, y_test]
data = np.r_[data_train, data_test]
print(data.shape)
np.savetxt('filename.csv', data, delimiter=',')
输出数据形状将为
(8732, 41)