In this python numpy program, we will find the median of the matrix using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create an array using np.array().
- Find the median of the matrix using np.median().
- Print the output.
import numpy as np
x = np.array([[5, 3],[7, 4]])
print("Median of array:",np.median(x))
Output :
Median of array: 4.5