[Numpy-discussion] NEP 21: Simplified and explicit advanced indexing (original) (raw)
Sebastian Berg sebastian at sipsolutions.net
Tue Jun 26 04:41:24 EDT 2018
- Previous message (by thread): [Numpy-discussion] NEP 21: Simplified and explicit advanced indexing
- Next message (by thread): [Numpy-discussion] NEP 21: Simplified and explicit advanced indexing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 2018-06-26 at 04:23 -0400, Hameer Abbasi wrote:
> Boolean indices are not supported. All indices must be integers, integer arrays or slices.
I would hope that there’s at least some way to do boolean indexing. I often find myself needing it. I realise that
arr.vindex[np.nonzero(booleanidx)]
works, but it is slightly too verbose for my liking. Maybe we can havearr.bindex[booleanindex]
as an alias to exactly that?
That part is limited to vindex
only. A single boolean index would
always work in plain indexing and you can mix it all up inside of
oindex
. But with fancy indexing mixing boolean + integer seems
currently pretty much useless (and thus the same is true for vindex
,
in oindex
things make sense).
Now you could invent some new logic for such a mixing case in vindex
,
but it seems easier to just ignore it for the moment.
- Sebastian
Or is boolean indexing preserved as-is n the newest proposal? If so, great!
Another thing I’d say is
arr.?index
should be replaced witharr.?idx
. I personally preferarr.?x
for my fingers but I realise that for someone not super into NumPy indexing, this is kind of opaque to read, so I propose this less verbose but hopefully equally clear version, for my (and others’) brains. Best Regards, Hameer Abbasi Sent from Astro for Mac
NumPy-Discussion mailing list NumPy-Discussion at python.org https://mail.python.org/mailman/listinfo/numpy-discussion -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180626/0cf50f9c/attachment.sig>
- Previous message (by thread): [Numpy-discussion] NEP 21: Simplified and explicit advanced indexing
- Next message (by thread): [Numpy-discussion] NEP 21: Simplified and explicit advanced indexing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]