How to calculate probability in a normal distribution given mean and standard deviation in Python? Last Updated : 25 Feb, 2021 Comments Improve Suggest changes Like Article Like Report A normal distribution is a type of continuous probability distribution for a real-valued random variable. It is based on mean and standard deviation. The probability distribution function or PDF computes the likelihood of a single point in the distribution. The general formula to calculate PDF for the normal distribution is f_X(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{\frac{-1}{2}\big( \frac{x-\mu}{\sigma} \big)^2}\\ Here, µ is the meanσ is the standard deviation of the distributionx is the number for which PDF is to be calculated.. We can calculate probability in a normal distribution using SciPy module. Installation: pip install scipy Function used: We will use scipy.stats.norm.pdf() method to calculate the probability distribution for a number x. Syntax: scipy.stats.norm.pdf(x, loc=None, scale=None) Parameter: x : array-like object, for which probability is to be calculated.loc : optional (default=0), represents mean of the distribution.scale : optional (default=1), represents standard deviation of the distribution. Returns: A probability density function calculated at x as a ndarray object. In scipy the functions used to calculate mean and standard deviation are mean() and std() respectively. For mean Syntax: mean(data) For standard deviation Syntax: std(data) ApproachImport moduleCreate necessary dataSupply the function with required valuesDisplay value Example: Python3 from scipy.stats import norm import numpy as np data_start = -5 data_end = 5 data_points = 11 data = np.linspace(data_start, data_end, data_points) mean = np.mean(data) std = np.std(data) probability_pdf = norm.pdf(3, loc=mean, scale=std) print(probability_pdf) Output: 0.0804410163156249 Comment More infoAdvertise with us Next Article How to calculate probability in a normal distribution given mean and standard deviation in Python? P piyushtiwari515 Follow Improve Article Tags : Python Python-scipy Python scipy-stats-functions Practice Tags : python Similar Reads How to Find Standard Deviation of Probability Distribution Standard Deviation is a measure in statistics that determines the amount of variability or dispersion in a set of values. Understanding how to calculate the standard deviation is useful for analyzing the variability or spread of random variables in probability distributions. In this article, we will 9 min read Calculate and Plot a Cumulative Distribution function with Matplotlib in Python Cumulative Distribution Functions (CDFs) show the probability that a variable is less than or equal to a value, helping us understand data distribution. For example, a CDF of test scores reveals the percentage of students scoring below a certain mark. Letâs explore simple and efficient ways to calcu 3 min read Calculate standard deviation of a dictionary in Python Python dictionary is a versatile data structure that allows a lot of operations to be done without any hassle. Calculating the standard deviation is shown below. Example #1: Using numpy.std() First, we create a dictionary. Then we store all the values in a list by iterating over it. After this using 2 min read Calculate standard deviation of a Matrix in Python In this article we will learn how to calculate standard deviation of a Matrix using Python. Standard deviation is used to measure the spread of values within the dataset. It indicates variations or dispersion of values in the dataset and also helps to determine the confidence in a modelâs statistica 2 min read How To Find Probability Distribution in Python A probability Distribution represents the predicted outcomes of various values for a given data. Probability distributions occur in a variety of forms and sizes, each with its own set of characteristics such as mean, median, mode, skewness, standard deviation, kurtosis, etc. Probability distribution 3 min read Like