Introduction to Statistics in Python
Maggie Matsui
Content Developer, DataCamp




Mean: 20
Standard deviation: 3

Standard normal distribution
Mean: 0
Standard deviation: 1

Mean: 20
Standard deviation: 3

Standard normal distribution
Mean: 0
Standard deviation: 1






Mean: 161 cm Standard deviation: 7 cm


16% of women in the survey are shorter than 154 cm
from scipy.stats import norm
norm.cdf(154, 161, 7)
0.158655

from scipy.stats import norm
1 - norm.cdf(154, 161, 7)
0.841345

norm.cdf(157, 161, 7) - norm.cdf(154, 161, 7)

norm.cdf(157, 161, 7) - norm.cdf(154, 161, 7)
0.1252

norm.ppf(0.9, 161, 7)
169.97086

norm.ppf((1-0.9), 161, 7)
152.029
# Generate 10 random heights
norm.rvs(161, 7, size=10)
array([155.5758223 , 155.13133235, 160.06377097, 168.33345778,
       165.92273375, 163.32677057, 165.13280753, 146.36133538,
       149.07845021, 160.5790856 ])
Introduction to Statistics in Python