python - how to get subset of matrix in class numpy.matrix.defmatrix.matrix -
python - how to get subset of matrix in class numpy.matrix.defmatrix.matrix -
the original matrix variable n , shape (138, 210). tried utilize n[:][:-1] , n[:][-1] subset of matrix n. shape of these 2 subsets (138,209) , (138,1). however, method not work. response (137,210) , (1,210). tried n[:-1][:], not work neither.
the type of n numpy.matrix.defmatrix.matrix
how can right answer?
does work you?
in [42]: n = np.random.rand(138, 210) in [43]: n[:, :-1].shape out[43]: (138l, 209l) in [44]: n[:, -1].shape out[44]: (138l,)
n[:, :-1]
(138, 209)
shape , n[:, -1]
(138, 1)
shape.
python numpy matrix
Comments
Post a Comment