human
Indexing one array by another in numpy
assistant
Here is some code to create a NumPy array containing elements of array `A` as pointed to by index in array `B`

A[np.arange(A.shape[0])[:, (None)], B]

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.