Answers for "argmax for 2d array"

1

argmax for 2d array

>>> a = numpy.random.random((10, 10))
>>> numpy.unravel_index(a.argmax(), a.shape)
(6, 7)
>>> a[6, 7] == a.max()
True
Posted by: Guest on May-08-2021

Browse Popular Code Answers by Language