Python Central HubSign in

Data Analytics with Python / Phase 8: Statistics for Data Analytics

Distributions (normal, binomial, Poisson)

Understand common distributions and when to use them in data analytics.

Why distributions matter

Distributions model uncertainty and randomness.

  • Normal: measurement noise, averages
  • Binomial: number of successes in N trials (conversions)
  • Poisson: counts over time/space (arrivals, events)

Picking the right distribution

diagram Choosing a distribution mermaid
A quick decision path from the kind of data you have to a matching distribution.

Normal distribution

  • Parameters: mean (\mu), std (\sigma)
  • Symmetric bell curve
Python
import numpy as np
 
x = np.random.normal(loc=0, scale=1, size=10_000)
print(x.mean(), x.std())

Binomial distribution

  • Parameters: trials (n), success prob (p)
  • Example: 100 visitors, conversion probability 0.03
Python
import numpy as np
 
samples = np.random.binomial(n=100, p=0.03, size=10_000)
print(samples.mean())

Poisson distribution

  • Parameter: rate (\lambda)
  • Example: number of support tickets per hour
Python
import numpy as np
 
samples = np.random.poisson(lam=5, size=10_000)
print(samples.mean())

Visualize it

The three distributions have distinct shapes: the normal is a smooth continuous bell, the binomial counts successes in a fixed number of trials, and the Poisson counts rare events over an interval. Seeing them side by side makes the differences click:

sketch Three common distributions p5.js
Normal is a smooth bell; binomial counts successes in n trials; Poisson counts rare events over an interval.

Practical tip

When unsure:

  • Plot a histogram of your data.
  • Start with simple candidates (normal vs count distributions).
  • Check mean/variance: for Poisson, mean ≈ variance.

Check your understanding

quizCheck yourself
  1. Which distribution models the number of conversions out of 100 visitors with probability 0.03?

    Show answer

    B — Binomial — Binomial counts successes in a fixed number of trials n with success probability p.

  2. Roughly what does np.random.binomial(n=100, p=0.03, size=10000).mean() print?

    Show answer

    B — About 3 — The expected value is n times p, which is 100 times 0.03 = 3.

  3. Which distribution fits support tickets per hour with rate lam=5?

    Show answer

    A — Poisson — Poisson models counts over time or space, and its mean equals lambda, so the sample mean is about 5.

  4. Which quick check hints that count data is Poisson?

    Show answer

    B — Mean is approximately equal to variance — For a Poisson distribution the mean and variance are both lambda.

🧪 Try It Yourself

Exercise 1 – Simulate a normal distribution

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Exercise 2 – Binomial trials

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Exercise 3 – Poisson arrivals

exerciseYour turn

Tab indents. Press Escape, then Tab, to leave the editor. Control plus Enter runs the code; Control plus Shift plus Enter submits it.

Output
Press Run to see what your code prints.

Next

Continue to Sampling and the Central Limit Theorem to see why sample means behave so predictably no matter which distribution you started from.

Was this page helpful?

Let us know how we did