Complete the code to import the Poisson distribution from scipy.stats.
from scipy.stats import [1]
The Poisson distribution is available as poisson in scipy.stats.
Complete the code to calculate the probability of exactly 3 events when the average rate is 2.
prob = poisson.pmf([1], mu=2)
The pmf function calculates the probability of exactly k events. Here, k=3.
Fix the error in the code to calculate the cumulative probability of up to 4 events with mean 3.
cum_prob = poisson.[1](4, mu=3)
The cdf function calculates the cumulative probability up to a given number of events.
Fill both blanks to create a dictionary of probabilities for 0 to 5 events with mean 2.
prob_dict = {k: poisson.[1](k, mu=[2]) for k in range(6)}Use pmf to get exact probabilities and mean 2 as given.
Fill all three blanks to filter events with probability greater than 0.1 from a dictionary.
filtered = {k: v for k, v in prob_dict.items() if v [1] [2]
threshold = [3]We filter probabilities greater than 0.1, so use > and 0.1 as threshold.