stats cdf python code example

Example 1: numpy cumulative distribution function normal

>>> vals = norm.ppf([0.001, 0.5, 0.999])
>>> np.allclose([0.001, 0.5, 0.999], norm.cdf(vals))
True

Example 2: stats.norm.cdf(2,loc=mean, scale=std_dev)

#calculating the probability or the area under curve to the left of this z value
import scipy.stats as stats
stats.norm.pdf(x, loc=mean, scale=std_dev)




# The probability (area) to the right is calculated as (1 - probability to the left)
import scipy.stats as stats
1 - stats.norm.pdf(x, loc=mean, scale=std_dev)