11 Normal distribution problems - Empirical rule (from ck12.org)
Contents
11 Normal distribution problems - Empirical rule (from ck12.org)#
%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/OhRr26AfFBU/" frameborder="0" allowfullscreen></iframe>
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats
68–95–99.7 rule#
credit: dataquest
mu = 9.5
sigma = 1.1
def cal_emperical_rule(mu, sigma):
mu = 7 * [mu]
sigma_scaler = np.arange(-3, 4, 1)
sigma_scales = sigma_scaler * sigma
emperical_rule_lst = mu + sigma_scales
return emperical_rule_lst
x = cal_emperical_rule(mu, sigma)
x
array([ 6.2, 7.3, 8.4, 9.5, 10.6, 11.7, 12.8])
sns.distplot(x)
/opt/hostedtoolcache/Python/3.9.13/x64/lib/python3.9/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)
<AxesSubplot:ylabel='Density'>