I have an array a of size (M, N, K).
And I have an array b of size (M, N) with integer values of [0, K-1].
How do I get the array... c of size (M, N), where
c[i, j] == a[i, j, b[i, j]]
in the simplest manner?
Which part of the indexing guide is it?
a[*np.indices(b.shape).reshape(2, -1), b.ravel()].reshape(*b.shape)c = np.array([ a[i, j, b[i,j]] for i in range(M) for j in range(N) ]).reshape(M, N). Post as a separate answer?