python-scipyHow do I use the scipy.stats.norm.cdf function in Python?
The scipy.stats.norm.cdf function in Python is used to calculate the cumulative distribution function (CDF) for a standard normal distribution. It takes two arguments: the point at which to evaluate the CDF, and the mean and standard deviation of the normal distribution.
Example code
from scipy.stats import norm
# Evaluate the CDF at x=1.2
x = 1.2
mu = 0
sigma = 1
cdf = norm.cdf(x, mu, sigma)
print(cdf)
Output example
0.8849303297782951
The code above calculates the CDF of a standard normal distribution at x=1.2. The norm.cdf function takes three arguments: x, mu, and sigma. x is the point at which to evaluate the CDF, mu is the mean of the normal distribution, and sigma is the standard deviation of the normal distribution. In this example, mu=0 and sigma=1 since we are evaluating the CDF of a standard normal distribution. The output of the code is 0.8849303297782951, which is the CDF of a standard normal distribution at x=1.2.
Helpful links
More of Python Scipy
- How do I create a 2D array of zeros using Python and NumPy?
- How can I use Python and SciPy to find the zeros of a function?
- How can I install and use SciPy on Ubuntu?
- How do I create a numpy array of zeros using Python?
- How can I use Python and Numpy to zip files?
- How do I use Scipy zeros in Python?
- How can I use Python SciPy to fit a model?
- How can I use Python Scipy to zoom in on an image?
- How can I use Python and Numpy to parse XML data?
- How do I use Python XlsxWriter to write a NumPy array to an Excel file?
See more codes...