Answers for "find max value in np array python"

0

get index of max value python numpy

Simple
>> b
array([0, 5, 2, 3, 4, 5])

>> np.argmax(b)  # Only the first occurrence is returned.
1
-----------------------------
#More complicated
>> a
array([[10, 11, 12],
       [13, 14, 15]])

>> np.argmax(a)
5

>> np.argmax(a, axis=0)
array([1, 1, 1])

>> np.argmax(a, axis=1)
array([2, 2])
Posted by: Guest on November-23-2021
1

max of matrix numpy

# Get the maximum element from a Numpy array
maxElement = numpy.amax(arr)
 
print('Max element from Numpy Array : ', maxElement)
Posted by: Guest on May-11-2020

Code answers related to "find max value in np array python"

Python Answers by Framework

Browse Popular Code Answers by Language