Mohan

Normalize a NumPy array to a unit vector in Python

In this article, we will learn how to normalize a NumPy array to a unit vector. Table Of Contents What is Normalization? What is a Unit vector? Method 1: Using unit_vector() method from transformations library Method 2: Using normalize() method from vg module. Method 3: Using linalg.norm() method from numpy module Method 4: Calculating norm

Normalize a NumPy array to a unit vector in Python Read More »

Calculate Euclidean distance using NumPy in Python

In this article we will learn How to calculate euclidean distance using numpy in Python. Table Of Contents What is euclidean distance? Calculate euclidean distance using sqrt() and sum() methods of numpy Calculate euclidean distance using norm() function Calculate euclidean distance using dot() Calculate euclidean distance using vdot() Calculate euclidean distance using np.linalg.multi_dot() Summary What

Calculate Euclidean distance using NumPy in Python Read More »

Get indices of N maximum values in a NumPy array in Python

In this article, we will learn how to get indices of N maximum values in a NumPy array. Table Of Contents Introduction Method 1: Using argpartition() function Method 2: Using argsort() function. Method 3: Using nlargest() of heapq module. Method 4. Iterating and finding indices of n maximum values Summary Introduction Suppose we have a

Get indices of N maximum values in a NumPy array in Python Read More »

Print NumPy Array without scientific notation in Python

In this article, we will learn how to print a numpy.array without scientific notation. Table Of Contents What is scientific notation? 1. Using set_printoptions() function and supress argument. 2. Using printoptions() function and supress argument. 3. Using set_printoptions() function and formatter argument. 4. Using array2string() function and suppress_small argument. Summary What is scientific notation? Scientific

Print NumPy Array without scientific notation in Python Read More »

Matrix Vector multiplication using NumPy in Python

In this article, we will learn matrix-vector multiplication using NumPy. Table Of Contents What is a matrix in numpy and how to create it? Perform matrix-vector multiplication using numpy with dot() Perform matrix-vector multiplication using numpy with matmul() method. Perform matrix-vector multiplication using @ operator. Summary What is a matrix in numpy and how to

Matrix Vector multiplication using NumPy in Python Read More »

Scroll to Top