DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

How to Use the Poisson Distribution in Python’s SciPy Stats

Use scipy.stats.poisson to calculate count probabilities, upper tails, discrete quantiles, and random samples—and learn how mu and loc affect results.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use scipy.stats.poisson to calculate exact and cumulative count probabilities, upper-tail probabilities, quantiles, and random Poisson samples. Its parameter mu is the expected count for the interval or exposure you are modeling; loc, when used, shifts the distribution’s support rather than changing that expected count.

What the Poisson distribution models

SciPy defines poisson as a discrete Poisson random variable. For a nonnegative integer count k, its probability mass function is exp(-mu) * mu**k / k!, with mu >= 0. The standard support is the integer counts starting at zero. SciPy’s Poisson reference

As an Amazon Associate I earn from qualifying purchases.

Choose mu to match the observation interval or exposure in your model. For example, a rate expressed per hour must be converted consistently if you are modeling a different duration; the API does not select the interval or infer a rate for you. Under the Poisson model, the theoretical mean and variance are both mu, and the standard deviation is sqrt(mu).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Calculate probabilities and samples

Import the distribution object and pass the count threshold and mu to the method that matches your question:

from scipy.stats import poisson

mu = 3.0
exactly_two = poisson.pmf(2, mu)
at_most_two = poisson.cdf(2, mu)
more_than_two = poisson.sf(2, mu)
quantile_95 = poisson.ppf(0.95, mu)
samples = poisson.rvs(mu, size=1000, random_state=0)

The example shows API usage; it is not a claim of an executed test. Method definitions and parameters are documented in the SciPy Poisson reference.

Question Method Meaning
What is the probability of exactly k events? poisson.pmf(k, mu) Probability mass at count k.
What is the probability of at most k events? poisson.cdf(k, mu) Probability that the count is less than or equal to k.
What is the probability of more than k events? poisson.sf(k, mu) Upper-tail probability, equivalent in meaning to 1 - cdf.
What count corresponds to probability q? poisson.ppf(q, mu) The discrete quantile at cumulative probability q.
How can I generate observations? poisson.rvs(mu, size=..., random_state=...) Random draws from the distribution; size sets the output shape.
What are the theoretical moments? poisson.mean(mu), poisson.var(mu), poisson.std(mu) or poisson.stats(mu) Mean, variance, standard deviation, or a moments summary.

Choose the right tail or quantile calculation

Use sf for an upper tail

poisson.sf(k, mu) means the probability of a count greater than k. It is often the direct choice for questions such as “more than five events.” SciPy notes that sf can be more accurate than calculating 1 - poisson.cdf(k, mu), especially when the CDF is close to one. SciPy Poisson API

Read ppf as a discrete quantile

For a discrete distribution, the CDF advances in steps. poisson.ppf(q, mu) returns the smallest integer count whose CDF is at least q; it is not a continuous inverse that can return any real-valued count. SciPy probability distributions tutorial

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand mu, loc, and zero

mu sets the Poisson count scale

mu is the nonnegative shape parameter in the probability formula and represents the expected count over the chosen interval or exposure. It is not a per-unit rate unless the chosen interval is that unit.

loc shifts the support

With loc, SciPy shifts the support: poisson.pmf(k, mu, loc) is equivalent to poisson.pmf(k - loc, mu). This shifts which values of the random variable are supported; it does not replace or modify mu. SciPy Poisson API

mu = 0 is a documented edge case

SciPy documents that when mu = 0, the PMF returns 1.0 at k = 0. SciPy Poisson API

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the discrete API conventions

Poisson counts are discrete, so use pmf rather than the continuous-distribution method pdf. SciPy’s discrete-distribution conventions also do not provide a scale parameter or estimation methods such as fit. Check the SciPy version installed in your environment against the documentation for that version if relying on version-specific behavior. SciPy probability distributions tutorial

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.