<div dir="auto">max(axis=1)?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 30, 2019, 7:33 PM Daniele Nicolodi <<a href="mailto:daniele@grinta.net">daniele@grinta.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
this is a very basic question, but I cannot find a satisfying answer.<br>
Assume a is a 2D array and that I get the index of the maximum value<br>
along the second dimension:<br>
<br>
i = a.argmax(axis=1)<br>
<br>
Is there a better way to get the value of the maximum array entries<br>
along the second axis other than:<br>
<br>
v = a[np.arange(len(a)), i]<br>
<br>
??<br>
<br>
Thank you.<br>
<br>
Cheers,<br>
Daniele<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank" rel="noreferrer">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>