Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

SciPy · Function

stats.poisson

scipy.stats.poisson represents a Poisson discrete random variable. Provide a nonnegative mu and use its distribution methods to evaluate probabilities, compute statistics, or generate random counts.

How it works

poisson is a discrete random-variable object for Poisson counts. Supply the nonnegative shape parameter mu to methods such as pmf, cdf, and rvs; use loc when the distribution should be shifted.

Syntax

scipy.stats.poisson = <scipy.stats._discrete_distns.poisson_gen object>

Parameters

NameTypeDescription
karray_likeQuantile or count at which a distribution method is evaluated.
muarray_likeNonnegative Poisson shape parameter.
locarray_like, optionalLocation parameter used to shift the distribution.

Returns

A Poisson distribution object exposing inherited discrete-distribution methods and Poisson-specific behavior.

Key points

  • The object models discrete event counts using a Poisson distribution.
  • It provides the standard discrete-distribution API, including probability, sampling, and statistical methods inherited from rv_discrete.
  • Its PMF is \(\exp(-\mu)\mu^k/k!\) for \(k\geq0\), giving the probability of each count.
  • Pass mu as the distribution's shape parameter, with zero allowed.
  • The optional loc argument translates the distribution's support.
  • A location shift in the PMF is equivalent to subtracting loc from the queried count.

Common mistakes

  • mu must be nonnegative; negative values do not define this distribution.
  • Use loc for a shifted support instead of modifying the count passed to every method.
  • The zero-rate case is degenerate: probability one is assigned to count zero.

Example: Evaluate and sample a Poisson distribution

from scipy.stats import poisson

mu = 3
k = 4
print(poisson.pmf(k, mu))
print(poisson.cdf(k, mu))
print(poisson.rvs(mu, size=5, random_state=0))

Computes the probability and cumulative probability for four events, then draws five reproducible random variates from a Poisson distribution with mean 3.

When to use it

Count probabilities

Estimating the likelihood of observing a specified number of events when the expected count is known.

Random variate generation

Generating synthetic event-count data for simulations or tests.

Shifted count distributions

Modeling counts whose support needs to be translated by a fixed integer offset.

Interview questions

QWhat does scipy.stats.poisson represent, and what constraint applies to mu?

poisson represents a Poisson discrete random variable, and its probability mass function is \(f(k)=\exp(-\mu)\mu^k/k!\) for nonnegative integer counts. The shape parameter mu must satisfy \(\mu\geq0\).

Follow-up: How would you shift the count values? Pass loc; the documentation states that shifting changes the distribution's location.

QHow do you calculate probabilities with the Poisson object?

Call methods such as poisson.pmf(k, mu) for a point probability and poisson.cdf(k, mu) for a cumulative probability. The object inherits generic methods from rv_discrete and adds the Poisson-specific definition.

Follow-up: How can the same distribution be reused with fixed parameters? Create a frozen object with poisson(mu, loc=...), then call its methods without resupplying those parameters.

QWhat is the effect of the loc parameter?

loc shifts the distribution. For the PMF, poisson.pmf(k, mu, loc) is equivalent to evaluating the unshifted distribution at k - loc.

Follow-up: What happens when mu is zero? The PMF returns 1.0 at k=0, making the distribution concentrated at zero before any location shift.

  • scipy.stats.rv_discrete
  • scipy.stats.poisson.pmf
  • scipy.stats.poisson.cdf
  • scipy.stats.poisson.rvs

Source: scipy.stats.poisson. Checked 2026-10-15.