how to calculate average in python using maths code example
Example 1: how to calculate mean in python
import statistics
a = [1,2,3,4,5]
mean = statistics.mean(a)
#Similar for other values such as variance, standard deviation
Example 2: mean python
import numpy as np
values=[1,10,100]
print(np.mean(values))
values=[1,10,100,np.nan]
print(np.nanmean(values))