[Numpy-discussion] argmax() indexes to value
Neal Becker
ndbecker2 at gmail.com
Wed Oct 30 21:10:01 EDT 2019
max(axis=1)?
On Wed, Oct 30, 2019, 7:33 PM Daniele Nicolodi <daniele at grinta.net> wrote:
> Hello,
>
> this is a very basic question, but I cannot find a satisfying answer.
> Assume a is a 2D array and that I get the index of the maximum value
> along the second dimension:
>
> i = a.argmax(axis=1)
>
> Is there a better way to get the value of the maximum array entries
> along the second axis other than:
>
> v = a[np.arange(len(a)), i]
>
> ??
>
> Thank you.
>
> Cheers,
> Daniele
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20191030/10965187/attachment.html>
More information about the NumPy-Discussion
mailing list