Statistical functions in Python

Even the simple most data analysis requires application of statistical functions

such as finding the mean value of a collection of data.

Python standard library has several statistical functions built-in with it.

The statistical functions are available to the programmer through the python module statistics, which can be imported as given here.

 

import statistics

 

The module statistics provides two types of functions.

  • A set of functions to find where the data is centered around in a distribution - i.e, Functions to find the measures of central tendencies. e.g., Mean(), Median(), Mode

 

  • A set of functions to find how the data is dispersed, meaning how the data is dispersed from the central values. e.g., pvariance(), pstdev() which find the variance and the standard deviation of the distribution.

 

List of statistical functions to find the measures of central tendency

 

mean()

Finds and returns the Arithmetic Mean of the data, popularly called as the average value of the data.

harmonic_mean()

Returns the harmonic mean also called as the subcontrary mean of the data

median()

Returns the median value, which is the middle value of the distribution.

median_low()

Returns the low median value of the distribution

median_high()

Returns the high median of the distribution

median_grouped()

Median of the grouped data will be returned.  

mode()

Returns the most occurring value of the distribution, which is called as the mode of the distribution.

 

List of statistical functions to find the measures of dispersion

 

pstdev

Returns the standard deviation of the population data

stdev

Returns the standard deviation the sample data

pvariance

Returns the variance of the population data

variance

Returns the variance of the sample data

 


Copyright 2024 © pythontic.com