what is mean in python code example

Example 1: how to get median mode average of a python list

>>> import statistics

>>> statistics.median([3, 5, 1, 4, 2])
3

>>> statistics.median([3, 5, 1, 4, 2, 6])
3.5

Example 2: python mean

# 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

Example 3: how to get median mode average of a python list

>>> import statistics

>>> statistics.mode([4, 1, 2, 2, 3, 5])
2

>>> statistics.mode([4, 1, 2, 2, 3, 5, 4])
4

>>> statistics.mode(["few", "few", "many", "some", "many"])
'few'

Example 4: mean python

import numpy as np
values=[1,10,100]
print(np.mean(values))
values=[1,10,100,np.nan]
print(np.nanmean(values))