The mean value is the average value. The median value is the value in the middle, after you have sorted all the values (If there are two numbers in the middle, divide the sum of those numbers by two). The Mode value is the value that appears the most number of times.
speed = [99,86,87,88,111,86,103,87,94,78,77,85,86]
mean = numpy.mean(speed)
print(“The mean value is the average value.”)
print(mean) # (99+86+87+88+111+86+103+87+94+78+77+85+86) / 13 = 89.77
median = numpy.median(speed)
print(“The median value is the value in the middle, after you have sorted all the values:”)
# If there are two numbers in the middle, divide the sum of those numbers by two.
print(median) # 87.0
from scipy import stats
mode = stats.mode(speed)
print(“The Mode value is the value that appears the most number of times:”)
print(mode) # The mode() method returns a ModeResult object that contains the mode number (86),
# and count (how many times the mode number appeared (3)).
std = numpy.std(speed)
print(“The standard deviation is:”)
print(std) # 9.258292301032677
# A low standard deviation indicates that the values tend to be close to the mean
# (also called the expected value) of the set,
# while a high standard deviation indicates that the values are spread out over a wider range.
# Percentiles are used in statistics to give you a number that describes the value
# that a given percent of the values are lower than.
# Example: Let’s say we have an array of the ages of all the people that lives in a street.
ages = [5,31,43,48,50,41,7,11,15,39,80,82,32,2,8,6,25,36,27,61,31]
x = numpy.percentile(ages, 75) # 43.0
print(“What is the 75. percentile?”)
print(x) # The answer is 43, meaning that 75% of the people are 43 or younger.