# Statistical Functions in Python

Python has ability to solve the mathematical expression,statistical data by importing statistic keyword. Python can do various types of statistical and mathematical operations.

These functions calculate the average value from a sample or population.

 mean () Arithmetic mean value (average) of data. harmonic_mean () Harmonic mean value of data. median () Median value (middle value) of data. median__low() Low median value of data. median__high() High median value of data. median__grouped() Median of the grouped data and also calculate the 50th percentile of the grouped data. mode() Maximum number of occurrence of data.

## mean()

This function calculates the arithmetic mean or average value of sample data in sequence or iterator.

## Example

list = [1, 2, 3,3,4,5,]
print ("The mean values is : ",end="")
print (statistics.mean(list))


## Output

The mean value is : 3


## harmonic_mean ()

This function calculates a sequential or iterative real- valued numbers (harmonic_ mean).

## Example

list = [1,2,3]
print ("The harmonic _mean values is : ",end="")
print (statistics.harmonic_mean(list))


## Output

The harmonic _mean values is :1.6


## median ()

This function calculates middle value of thearithmetic data in iterative order.

## Example

list= [1, 3,5,7]
print ("The median values is : ",end="")
print (statistics.median(list))


## Output

The median values is :4.0


## median__low()

This function calculates the median of data in case of odd number but in case of even number of elements it calculates the lower of two middle elements of the data.

## Example

list = [1,2,2,3,3,3]
print ("The median_low values is : ",end="")
print (statistics.median_low(list))


## Output

The median_low values is :2


## median_high()

This function calculates the median of data incase of odd number, but in case of even number of elements, it calculates the higher of two middle elements of the data.

## Example

list = [1,2,2,3,3,3]
print ("The median_high values is : ",end="")
print (statistics.median_high(list))


## Output

The median_high values is :3


## median_grouped()

This function is used to calculate median of the groped data also calculate 50th percentile of the grouped data

## Example

list = [2,2,3,4]
print ("The median_grouped values is : ",end="")
print (statistics.median_grouped(list))


## Output

The median_grouped values is : 2.5


## mode()

This function return the most common data point from discrete or nominal data or number with maximum number of occurrences.

## Example

list = [2,2,3,4,4,1,2]
print ("The mode values is : ",end="")
print (statistics.mode(list))


## Output

The mode values is : 2


karthikeya Boyini

I love programming (: That's all I know

Updated on: 30-Jul-2019

3K+ Views