The Poisson distribution estimates how likely different event counts are within a fixed interval, such as views in one minute. Its parameter μ, also written λ, is the average number of events in that interval. section 3.9
Use the distribution to:
- Estimate probabilities for specific counts, such as 0 through 20 views. section 3.9
- Expect values near the average to be more likely; with μ = 10, 9 and 11 are plausible while 20 is unlikely. section 3.9
- Treat sustained changes in the observed average as evidence that the underlying distribution may have changed. section 3.9
A video's views per minute
Suppose a new video averages 10 views per minute. scipy.stats.poisson.pmf can calculate the probability of each count, while matplotlib can display those probabilities as a bar chart. numpy.random.poisson can generate simulated counts; each run varies, as real event counts do. section 3.9
import numpy as np
from scipy.stats import poisson
mean = 10 #1
x = np.arange(0, 21, 1) #2
y = poisson.pmf(x, mu=mean) #3
for _x, _y in zip(x, y): #4
print(f"The probability of {_x} views within 1 minute is {_y:.4f}") #5
Shows Python code that calculates probabilities for 0–20 views using scipy.stats.poisson.pmf. section 3.9
from numpy.random import poisson sample = poisson(lam=10, size=20) print(sample) # Your answer will differ: # array([ 8, 9, 12, 5, 7, 7, 13, 8, 13, 6, 11, # 5, 9, 11, 4, 12, 12, 6, 10, 10])
Shows how NumPy generates simulated event counts from a Poisson distribution. section 3.9






