On Wed, 2018-06-20 at 09:15 -0400, Michael Lamparski wrote:
> > There is a way that will generally work using triple indexing:
> >
> > arr[..., None, None][orig_indx + (slice(None), np.array(0))][...,
> 0]
>
> Impressive! (note: I fixed the * typo in the quote)
>
> > The first and last indexing o
> There is a way that will generally work using triple indexing:
>
> arr[..., None, None][orig_indx + (slice(None), np.array(0))][..., 0]
Impressive! (note: I fixed the * typo in the quote)
> The first and last indexing operation is just a view creation, so it is
> basically a no-op. Now doing th
On Tue, 2018-06-19 at 19:37 -0400, Michael Lamparski wrote:
> Hi all,
>
> So, in advanced indexing, numpy decides where to put new axes based
> on whether the "advanced indices" are all next to each other.
>
> >>> np.random.random((3,4,5,6,7,8))[:, [[0,0],[0,0]], 1, :].shape
> (3, 2, 2, 6, 7, 8)
Hi all,
So, in advanced indexing, numpy decides where to put new axes based on
whether the "advanced indices" are all next to each other.
>>> np.random.random((3,4,5,6,7,8))[:, [[0,0],[0,0]], 1, :].shape
(3, 2, 2, 6, 7, 8)
>>> np.random.random((3,4,5,6,7,8))[:, [[0,0],[0,0]], :, 1].shape
(2, 2, 3