Introduction to Statistics in Python
Maggie Matsui
Content Developer, DataCamp
If the average number of adoptions per week is 8, what is $P(\text{\# adoptions in a week} = 5)$?
from scipy.stats import poisson
poisson.pmf(5, 8)
0.09160366
If the average number of adoptions per week is 8, what is $P(\text{\# adoptions in a week} \le 5)$?
from scipy.stats import poisson
poisson.cdf(5, 8)
0.1912361
If the average number of adoptions per week is 8, what is $P(\text{\# adoptions in a week} \gt 5)$?
1 - poisson.cdf(5, 8)
0.8087639
If the average number of adoptions per week is 10, what is $P(\text{\# adoptions in a week} \gt 5)$?
1 - poisson.cdf(5, 10)
0.932914
from scipy.stats import poisson
poisson.rvs(8, size=10)
array([ 9, 9, 8, 7, 11, 3, 10, 6, 8, 14])
Introduction to Statistics in Python