Suppose I have a matrix A with some arbitrary values:
array([[ 2, 4, 5, 3], [ 1, 6, 8, 9], [ 8, 7, 0, 2]])
A
I know this is an old question, but another way of doing it using indices is:
A[np.indices(B.shape)[0], B]
output:
[[2 2 4 5] [1 9 8 6] [2 0 7 8]]