## How to Fix – NameError: name ‘numpy’ is not defined

If you are working with Python and trying to use the numpy library, you may encounter the “NameError: name ‘numpy’ is not defined” error. In this tutorial, we will explore why this error occurs and the steps required to fix it such that your Python code can successfully run without errors. We will cover common …

## Sort a Numpy Array by a Specific Column

In this tutorial, we will look at how to sort a numpy array by a column with the help of some examples. To sort a numpy array by a given column, use the following steps – The following is the syntax – The above code sorts the array by the values in the column with …

## Count Unique Values in a Numpy Array

In this tutorial, we will look at how to count unique values in a Numpy array with the help of some examples. There’s no direct function (like the Pandas nunique() function for a pandas series) to get the count of unique values in a Numpy array. You can, however, use the numpy.unique() function to get …

## Numpy – Check If Matrix is an Identity Matrix

In this tutorial, we will look at how to check if a matrix is an identity matrix in Numpy with the help of some examples. What is an identity matrix? An identity matrix is a square matrix with all diagonal elements as 1 and all non-diagonal elements as zero. The following image shows some identity …

## Numpy – Check If Two Matrices are Equal

In this tutorial, we will look at how to check if two matrices (2d numpy arrays) are equal or not with the help of some examples. How to check if two matrices are equal in numpy? There are multiple ways using which you can assess whether two numpy arrays (including 2d arrays which we generally …

## Numpy – Check If a Matrix is Orthogonal

In this tutorial, we will look at how to check if a numpy matrix (a 2d numpy array) is orthogonal or not with the help of some examples. When is a matrix orthogonal? A real square matrix, for example, M is said to be orthogonal, if the dot product of the matrix with its transpose …

## Numpy – Check If a Matrix is Invertible

In this tutorial, we will look at how to check if a numpy matrix (a 2d numpy array) is invertible or not with the help of some examples. When is a matrix invertible? A square matrix, for example, M is said to be invertible, if there exists a matrix N such that, MN = NM …

## How to check if a matrix is symmetric in Numpy?

In this tutorial, we will look at how to check if a numpy matrix (a 2d numpy array) is a symmetric matrix or not with the help of some examples. What is a symmetric matrix? A matrix is said to be symmetric if it is equal to its transpose. That is, the matrix and its …

## How to check if a matrix is a square matrix in Numpy?

In this tutorial, we will look at how to check if a numpy matrix (a 2d numpy array) is a square matrix or not with the help of some examples. What is a square matrix? A matrix is said to be a square matrix if the number of rows is equal to the number of …

## Numpy – Check if Matrix is a Lower Triangular Matrix

In this tutorial, we will look at how to check if a numpy matrix (a 2d numpy array) is a lower triangular matrix or not with the help of some examples. What is a lower triangular matrix? A matrix is considered an upper triangular matrix if all the elements above the main diagonal are zero. …