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

SciPy · Function

stats.norm

scipy.stats.norm represents a normal continuous random variable. Its loc and scale parameters control the mean and standard deviation, and its inherited distribution methods support common probability calculations.

How it works

norm represents a normal continuous random variable and provides the generic continuous-distribution methods inherited from rv_continuous. Use loc to set the mean and scale to set the standard deviation; methods such as pdf, cdf, and ppf then operate on that parameterized distribution.

Syntax

scipy.stats.norm

Parameters

NameTypeDescription
xarray_likeInput value or values at which an inherited distribution method is evaluated.
locfloat, optionalLocation parameter specifying the mean; defaults to 0 for the standard normal.
scalefloat, optionalScale parameter specifying the standard deviation; defaults to 1 for the standard normal.

Returns

An rv_continuous distribution object representing a normal continuous random variable; its inherited methods return values appropriate to the selected operation.

Key points

  • scipy.stats.norm models the normal continuous distribution.
  • Set the distribution mean with the loc keyword.
  • Its standard-form density is the normal density function.
  • The documented density starts from the standardized normal form.
  • Use loc and scale to obtain shifted or scaled normal distributions.
  • The object inherits the common continuous-distribution method collection from rv_continuous.

Common mistakes

  • scale is the standard deviation, not the variance.
  • When changing location or scale, the density includes division by the scale; it is not just a shifted standard density.

Example: Use a parameterized normal distribution

from scipy.stats import norm

mean = 10
std = 2
x = 12

probability_density = norm.pdf(x, loc=mean, scale=std)
probability_below = norm.cdf(x, loc=mean, scale=std)
quantile = norm.ppf(0.95, loc=mean, scale=std)

print(probability_density)
print(probability_below)
print(quantile)

Evaluate density, cumulative probability, and a quantile for a normal distribution with mean 10 and standard deviation 2.

When to use it

Probability calculations

Compute the likelihood or cumulative probability associated with observed numeric values.

Quantile analysis

Convert probabilities into values on a normal distribution using quantiles.

Parameterized normal modeling

Generate or analyze data under a normal model with chosen mean and standard deviation.

Interview questions

QWhat do loc and scale mean for norm?

loc specifies the distribution's mean, while scale specifies its standard deviation. The object is a continuous random variable with generic methods supplied by rv_continuous.

Follow-up: How would you standardize a value? Compute y = (x - loc) / scale, then use the standard normal methods on y.

QHow does norm relate to the standard normal distribution?

The standard normal density is evaluated at a real-valued input using the documented normal density formula. A nonstandard normal distribution is obtained by shifting with loc and scaling with scale.

Follow-up: Why does the density divide by scale? Scaling must preserve total probability, so the horizontal stretch is offset by a reciprocal density factor.

QWhat API does norm inherit?

norm is an instance of rv_continuous, so it exposes the inherited continuous-distribution methods in addition to the normal-specific distribution definition. This supports operations such as density, cumulative probability, and random-variates workflows through the common API.

Follow-up: What design benefit does the shared base class provide? Code can use a consistent interface across continuous distributions while each distribution supplies its own details.

  • scipy.stats.rv_continuous
  • scipy.stats.norm.pdf
  • scipy.stats.norm.cdf
  • scipy.stats.norm.ppf
  • scipy.stats.norm.rvs

Source: scipy.stats.norm — SciPy v1.18.0 Manual. Checked 2026-10-15.