Articles → Numpy → Find The Minimum And Maximum Value In Numpy Arrays
Find The Minimum And Maximum Value In Numpy Arrays
Example
import numpy as np
# Create an array
arr = np.random.randint(0,30,10)
print("Array:", arr)
print("Minimum value in array", arr.min())
print("Index of min value in array", arr.argmin())
print("Maximum value in array", arr.max())
print("Index of min value in array", arr.argmax())
- An array is created using randint function
- Find the minimum value in an array using min() function
- Find the index of minimum value in an array
- Find the maximum value in an array using max() function
- Find the index of maximum value in an array
Output
Click to Enlarge