I've a 3D array that I need to recover the data corresponding to one specific index from an specifique axis.
x_train.shape
Out[101]: (990, 19, 3)
x_train[:,0,:]
Out[117]:
array([[0.08581368, 0.09640129, 0.09044931],
[0.09701243, 0.09834351, 0.09823458],
[0.09433366, 0.09251685, 0.09408623],
...,
[0.88172483, 0.9100043 , 0.89555236],
[0.90901481, 0.9104525 , 0.90519397],
[0.89063546, 0.90311315, 0.90350811]])
I need to get only the index 0 from this array
0.08581368,
0.09701243,
0.09433366,
...,
0.90901481,
0.89063546
I've tried splitting the array with my_new_array = np.split(x_train, 990, axis=0) but I get a list (990) and for each record I 've a type array (1,19,13)
It doesn't fix my problem.
I've checked some solutions right here in stack, besides this solution comes from here, but there's something I don't get, and I really appreciate if you can help.
答案 0 :(得分:0)
The first index would be x_train[:, 0, :][0]
which is directly accessed via
x_train[0, 0, :]
which is the first row - but this is not what you want.
Your example looks like the first column, and this can be accessed by
x_train[:, 0, 0]