[Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

Robert Kern robert.kern at gmail.com
Tue Mar 3 20:26:38 EST 2009


On Tue, Mar 3, 2009 at 03:11, Stéfan van der Walt <stefan at sun.ac.za> wrote:
> Hi Robert
>
> 2009/2/27 Robert Kern <robert.kern at gmail.com>:
>>> a[ix_([2,3,6],range(a.shape[1]),[3,2])]
>>>
>>> If anyone knows a better way?
>>
>> One could probably make ix_() take slice objects, too, to generate the
>> correct arange() in the appropriate place.
>
> I was wondering how one would implement this, since the ix_ function
> has no knowledge of the dimensions of "a".

No, you're right. It doesn't work.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list