Instagram
youtube
Facebook
Twitter

Find the Minimum Value in a NumPy Array

    A Find the Minimum Value in a NumPy Array
    
    Short Description of the Program:

    This program creates a NumPy array and finds the minimum value present in it using the np.min() function.
    
     Explanation:

  • np.array()
    Creates a 2D NumPy array with integer elements.

     
  • np.min(array_values)
    Returns the smallest value from all elements in the array.

     
  • print()
    Prints both the original array and the smallest number in it.

Program:

import numpy as np

array_values = np.array([[12, 45, 23], [67, 34, 89]])

min_value = np.min(array_values)

print("NumPy Array:\n", array_values)

print("\nMinimum Value in the Array:", min_value)