Re: [Numpy-discussion] Multidimensional Indexing

2015-04-08 Thread Sebastian Berg
On Di, 2015-04-07 at 00:49 +0100, Nicholas Devenish wrote: > With the indexing example from the documentation: > > y = np.arange(35).reshape(5,7) > > Why does selecting an item from explicitly every row work as I’d expect: > >>> y[np.array([0,1,2,3,4]),np.array([0,0,0,0,0])] > array([ 0, 7, 14,

Re: [Numpy-discussion] Multidimensional Indexing

2015-04-08 Thread Chad Fulton
On Mon, Apr 6, 2015 at 4:49 PM, Nicholas Devenish wrote: > With the indexing example from the documentation: > > y = np.arange(35).reshape(5,7) > > Why does selecting an item from explicitly every row work as I’d expect: y[np.array([0,1,2,3,4]),np.array([0,0,0,0,0])] > array([ 0, 7, 14, 21,

Re: [Numpy-discussion] Multidimensional Indexing

2015-04-08 Thread Nikolay Mayorov
I think the rationale is to allow selection of whole rows / columns. If you want to choose a single element from each row/column, then, yes, you have to pass np.arange(...). There is also np.choose function, but not recommended to use for such cases as far as I understand. I'm not an expert, tho