Statistical Functions in Python | Set 2 ( Measure of Spread) Last Updated : 10 Feb, 2020 Comments Improve Suggest changes Like Article Like Report Statistical Functions in Python | Set 1(Averages and Measure of Central Location) Measure of spread functions of statistics are discussed in this article. 1. variance() :- This function calculates the variance i.e measure of deviation of data, more the value of variance, more the data values are spread. Sample variance is computed in this function, assuming data is of a part of population. If passed argument is empty, StatisticsError is raised. 2. pvariance() :- This function computes the variance of the entire population. The data is interpreted as it is of the whole population. If passed argument is empty, StatisticsError is raised. Python # Python code to demonstrate the working of # variance() and pvariance() # importing statistics to handle statistical operations import statistics # initializing list li = [1.5, 2.5, 2.5, 3.5, 3.5, 3.5] # using variance to calculate variance of data print ("The variance of data is : ",end="") print (statistics.variance(li)) # using pvariance to calculate population variance of data print ("The population variance of data is : ",end="") print (statistics.pvariance(li)) Output: The variance of data is : 0.6666666666666667 The population variance of data is : 0.5555555555555556 3. stdev() :- This function returns the standard deviation ( square root of sample variance ) of the data. If passed argument is empty, StatisticsError is raised. 4. pstdev() :- This function returns the population standard deviation ( square root of population variance ) of the data. If passed argument is empty, StatisticsError is raised. Python # Python code to demonstrate the working of # stdev() and pstdev() # importing statistics to handle statistical operations import statistics # initializing list li = [1.5, 2.5, 2.5, 3.5, 3.5, 3.5] # using stdev to calculate standard deviation of data print ("The standard deviation of data is : ",end="") print (statistics.stdev(li)) # using pstdev to calculate population standard deviation of data print ("The population standard deviation of data is : ",end="") print (statistics.pstdev(li)) Output: The standard deviation of data is : 0.816496580927726 The population standard deviation of data is : 0.7453559924999299 Comment More infoAdvertise with us Next Article Statistical Functions in Python | Set 1 (Averages and Measure of Central Location) K kartik Improve Article Tags : Python Practice Tags : python Similar Reads Statistical Functions in Python | Set 1 (Averages and Measure of Central Location) Python has the ability to manipulate some statistical data and calculate results of various statistical operations using the file "statistics", useful in domain of mathematics. Important Average and measure of central location functions : 1. mean() :- This function returns the mean or average of the 3 min read mode() function in Python statistics module The mode of a set of data values is the value that appears most frequently. In statistics, itâs often used to understand the most common or popular value within a set. A mode of a continuous probability distribution is often considered to be any value 'x' at which its probability density function ha 3 min read mode() function in Python statistics module The mode of a set of data values is the value that appears most frequently. In statistics, itâs often used to understand the most common or popular value within a set. A mode of a continuous probability distribution is often considered to be any value 'x' at which its probability density function ha 3 min read statistics mean() function - Python The mean() function from Pythonâs statistics module is used to calculate the average of a set of numeric values. It adds up all the values in a list and divides the total by the number of elements. For example, if we have a list [2, 4, 6, 8], the mean would be (2 + 4 + 6 + 8) / 4 = 5.0. This functio 4 min read statistics mean() function - Python The mean() function from Pythonâs statistics module is used to calculate the average of a set of numeric values. It adds up all the values in a list and divides the total by the number of elements. For example, if we have a list [2, 4, 6, 8], the mean would be (2 + 4 + 6 + 8) / 4 = 5.0. This functio 4 min read Wand statistic() function in Python Statistic effect is similar to Spread effect, the only difference is that, it replaces each pixel with the result of a mathematical operation performed against neighboring pixel values.The width & height defines the size, or aperture, of the neighboring pixels. The type of statistic operations c 1 min read Like