There is also numpy.s_:
inds = np.s_[...,2,:]
z[inds]
(Though there are some problems with negative indices: see for example
http://www.mail-archive.com/numpy-discussion@scipy.org/msg18245.html)
On 8 Aug 2009, at 10:02 PM, T J wrote:
> On Sat, Aug 8, 2009 at 8:54 PM, Neil Martinsen-Burrell > w
On Sat, Aug 8, 2009 at 8:54 PM, Neil Martinsen-Burrell wrote:
>
> The ellipsis is a built-in python constant called Ellipsis. The colon
> is a slice object, again a python built-in, called with None as an
> argument. So, z[...,2,:] == z[Ellipsis,2,slice(None)].
>
Very helpful! Thank you. I did
On 2009-08-08 22:46 , T J wrote:
> I have an array, and I need to index it like so:
>
> z[...,x,:]
>
> How can I write code which will index z, as above, when x is not known
> ahead of time. For that matter, the particular dimension I am querying
> is not known either. In case this is still c
I have an array, and I need to index it like so:
z[...,x,:]
How can I write code which will index z, as above, when x is not known
ahead of time. For that matter, the particular dimension I am querying
is not known either. In case this is still confusing, I am looking
for the NumPy way to do