[Numpy-discussion] Getting 3-D array values from a 2-D array of indexes

Jordan Dawe jdawe at eos.ubc.ca
Mon Jan 8 20:12:04 EST 2007


I have a 3D array A of shape (nz, ny, nx) and a 2D array B of shape (ny, 
nx) that contains integer indexes.  I want to generate a 2D array C of 
shape (ny, nx) composed of the values of A at the z-indexes specified in 
B.  Is there an easy way to do this?

Jordan



More information about the NumPy-Discussion mailing list