Python Machine Learning

Mean Median Mode

Statistical measures

Mean Median Mode

Mean, median, and mode are measures of central tendency in statistics.

Mean

The mean value is the average value:

import numpy as np

speed = [99, 86, 87, 88, 111, 86, 103, 87, 94, 78, 77, 85, 86]

x = np.mean(speed)
print(x)

Median

The median value is the value in the middle:

x = np.median(speed)
print(x)

Mode

The Mode value is the value that appears the most number of times:

from scipy import stats

x = stats.mode(speed)
print(x)