06 Impact on median & mean - removing an outlier#

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

khanacademy

Impact on median & mean - removing an outlier fig 1Impact on median & mean - removing an outlier fig 2

x = np.array([80, 90, 92, 94, 96])
y = x[1:]
print(f'mean of x: {np.mean(x)}')
print(f'mean of y: {np.mean(y)}')
mean of x: 90.4
mean of y: 93.0
print(f'median of x: {np.median(x)}')
print(f'median of y: {np.median(y)}')
median of x: 92.0
median of y: 93.0