Search code examples
pythonscipypoisson

why scipy poisson do not have a pdf (probability density function) method?


I want to plot the probability density function of a Poisson distribution in python created using scipy. If I want to plot the pdf of a beta distribution, I would do something like the following:

x = np.linspace(0, 1, 200)
alphas = 4
betas = 10
pdf = st.beta.pdf(x, alpha, beta)
plt.plot(x, pdf, label=r'$\alpha$ = {}, $\beta$ = {}'.format(alpha, beta))

I thought I could do the same with a Poisson distribution, but unfortunately, the object does not have the pdf method! why? how can I plot a Poisson pdf without writing the formula myself?


Solution

  • The poisson distribution is a discrete distribution and does not have a density function. It however has a mass function, which you can access using scipy.stats.poisson.pmf().