On Thu, May 20, 2021 at 1:40 PM CJ Carey <perimosocord...@gmail.com> wrote:
> Or as a one-liner: > > out[np.arange(len(x)), x] = 1 > Ah, right. `x[arange(len(x))]` is a no-op. > If NEP 21 is accepted ( > https://numpy.org/neps/nep-0021-advanced-indexing.html) this would be > even simpler: > > out.vindex[:, x] = 1 > > Was there ever a decision about that NEP? I didn't follow the discussion > too closely at the time. > IIRC, I think there was broad agreement on the final plan as stated in the NEP. I suspect, though, that the general appetite for adding to the array API surface has declined even from its anemic starting point, now that deep learning frameworks with ndarray-mimicking APIs have taken off. -- Robert Kern
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion