Skip to content

Instantly share code, notes, and snippets.

@lucdangelis
Last active February 28, 2022 18:31
Show Gist options
  • Save lucdangelis/28cb61ac540387f0abcceb7d3b09bf4b to your computer and use it in GitHub Desktop.
Save lucdangelis/28cb61ac540387f0abcceb7d3b09bf4b to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import poisson,expon,nbinom
poisson_lambda = 4.3
p_arr = []
distribution = poisson(poisson_lambda)
for transactions in range(0,10):
p_arr.append(distribution.pmf(transactions))
plt.ylabel('Probability')
plt.xlabel('Number of Transactions')
plt.xticks(range(0, 10))
plt.title('Poisson Probability Mass Function')
plt.plot(p_arr, color='black', linewidth=0.7, zorder=1)
plt.scatter(range(0, 10), p_arr, color='purple', edgecolor='black', linewidth=0.7, zorder=2)
display(plt.show())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment