Most efficient way to index a numpy array by the indices of another numpy array
I have a numpy array A
with shape (a, b, c), and another integer array L
with shape (a, b). I want to make an array B
such that B[i, j, k] = A[L[i, j], k]
(assume shapes and values of L
permit this).