v Find The Rank Of A Matrix - Machine Learning

Find The Rank Of A Matrix

Preliminaries

# Load library
import numpy as np

Create Matrix

# Create matrix
matrix = np.array([[1, 2, 3],
                   [4, 5, 6],
                   [7, 8, 9]])

Find Rank Of Matrix

# Return matrix rank
np.linalg.matrix_rank(matrix)
2