Python 統計學入門
Maggie Matsui
Content Developer, DataCamp



若每週平均認養數為 8,則 $P(\text{\# adoptions in a week} = 5)$ 是多少?
from scipy.stats import poissonpoisson.pmf(5, 8)
0.09160366
若每週平均認養數為 8,則 $P(\text{\# adoptions in a week} \le 5)$ 是多少?
from scipy.stats import poisson
poisson.cdf(5, 8)
0.1912361
若每週平均認養數為 8,則 $P(\text{\# adoptions in a week} \gt 5)$ 是多少?
1 - poisson.cdf(5, 8)
0.8087639
若每週平均認養數為 10,則 $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])

Python 統計學入門