Grizzly
0
Q:

mean python

if a == 2: # Compares whether a is equal to 2
    print a
1
import statistics

a = [1,2,3,4,5]

mean = statistics.mean(a) 
#Similar for other values such as variance, standard deviation
0
import numpy as np
values=[1,10,100]
print(np.mean(values))
values=[1,10,100,np.nan]
print(np.nanmean(values))
1
# Probably the most convenient set of statistics functions are found
# in the Numpy package

# Basic syntax:
import numpy as np
np.mean(your_list) # Calculate mean
np.median()	# Calculate median
np.std()	# Calculate standard deviation
np.var()	# Calculate variance
1
# in python == means that is a comparisson operator meaning it compares if one 
# variable equals the other. Instead of using one = since that will assign
# a value we use ==
0

New to Communities?

Join the community