On Tue, Jan 15, 2013 at 3:44 PM, Charles R Harris <charlesr.har...@gmail.com> wrote: > Fancy indexing is a funny creature and not easy to understand in more than > one dimension. What is happening is that each index is replaced by the > corresponding row of a and the result is of shape (5,2,2). To do what you > want to do: > > In [20]: a[i, [[0,1]]*5] > Out[20]: > array([[ 1, 3], > [ 4, 6], > [ 8, 7], > [11, 9], > [23, 12]]) > > I agree that there should be an easier way to do this.
Slightly easier, though no more transparent: a[i, [0,1]] http://docs.scipy.org/doc/numpy/user/basics.indexing.html#indexing-multi-dimensional-arrays -- Robert Kern _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion