Instagram
youtube
Facebook
Twitter

Find the Maximum Value in a NumPy Array

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

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

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

     
  • np.max(array_values)
    Returns the largest value from the entire array.

     
  • print()
    Displays both the array and the maximum value.

Program:

import numpy as np
array_values = np.array([[12, 45, 23], [67, 34, 89]])
max_value = np.max(array_values)
print("NumPy Array:\n", array_values)
print("\nMaximum Value in the Array:", max_value)