Let's say that I have a matrix with a given dimension, and also one array that contains a range of values. The values contained in the array are the indexes of the rows in which I want to extract the values out of my matrix. So, an example could be:
A = np.array([[3, 6, 7, 5, -3, 0], [5, -2, 2, 51, -13, 8], [13, -17, 18, 22, -12, 90], [33, -12, 12, 32, -42, 90]])
B = np.array([0, 2, 3])
the result expected:
array([[ 3,  7,  5],
       [ 5,  2, 51],
       [13, 18, 22],
       [33, 12, 32]])
 
    