Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- import seaborn as sns
- from scipy.stats import poisson
- # If we have know that between 4:30pm and 4:45pm each weekday an average of 3.6 customers enter any given checkout line. What is the probability that exactly 7 customers enter your line between 4:30pm and 4:45pm?
- mu = 3.6
- exact_seven = 7
- poisson.pmf(exact_seven, mu)
- seven_or_less = poisson.cdf(7,mu)
- seven_or_less
- seven_or_most = 1 - poisson.cdf(6,mu)
- seven_or_most
- poisson.mean(3.6)
- poisson.var(3.6)
- poisson.std(3.6)
- # Visualization
- sns.set_theme(style = 'darkgrid')
- x_ax = np.arange(0,11)
- y_ax = poisson.pmf(x_ax, 3.6)
- sns.barplot(x = x_ax, y = y_ax)
- plt.show()
- y_ax = poisson.cdf(x_ax, 3.6)
- sns.barplot(x = x_ax, y = y_ax)
- plt.show()
Add Comment
Please, Sign In to add comment