On 2014-12-04 03:41:35, Jaime Fernández del Río <jaime.f...@gmail.com> wrote: > nx = np.arange(A.shape[0])[:, np.newaxis] > ny = np.arange(A.shape[1]) > C = A[nx, ny, B]
That's the correct answer--in my answer I essentially wrote C = A[B] (== A[B, :, :]) which broadcasts the shape of B against the second and third dimensions of A (it's almost always a bad idea to combine index broadcasting and slicing). The notes I linked to are correct, though, and explain Jamie's answer in more detail (search for "Jack's Dilemma"). Regards Stéfan _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion