NumPy Math functions

Addition of NumPy array

import numpy as np

n1 = np.array([10, 20])
n2 = np.array([30, 40])

np.sum([n1, n2])
Output = 100

We can also add only column or row using axis parameter.

np.sum([n1, n2], axis = 0)
Output: array([30, 40])

np.sum([n1, n2], axis = 1)
Output: array([30, 70])

How to calculate Mean of numPy array?

import numpy as np
n1 = np.array([10, 20, 30, 40, 50, 60])
Output: 35

How to calculate Standard Deviation of array?


How to calculate Median function of array?


Leave a Comment

Your email address will not be published. Required fields are marked *