02 Mean, median, & mode example#

%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/k3aKKasOmIw/" frameborder="0" allowfullscreen></iframe>
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
from scipy import stats

khanacademy

Mean, median, & mode example fig 1Mean, median, & mode example fig 2

x = np.array([20,21,23,23,25,29,32,33])
print(f'mean {np.mean(x)}')
print(f'median {np.median(x)}')
mode, count = stats.mode(x)
print(f'mode {mode[0]} count {count[0]}')
mean 25.75
median 24.0
mode 23 count 2