[Numpy-discussion] 3D array -> 2D array issue...

Fred fredmfp@gmail....
Mon Feb 7 07:19:25 CST 2011


Le 07/02/2011 13:37, josef.pktd@gmail.com a écrit :
> n0, n1 = k.shape
> ind0 = np.arange(n0)[:,None]
> ind1 = np.arange(n1)
> q0 = C1[ind0,ind1, k[ind0,ind1]]
>
> or better
> q0 = C1[ind0,ind1, k]
Great!!!

Thanks a lot.


Cheers,

-- 
Fred


More information about the NumPy-Discussion mailing list