Statistics is a module in Python, which can give the information about the data

If you are not aware of statistics then just go to http://blog.robofied.com/statistics/ In this tutorial will see how to use statistics module of Python in order to access the functions of statistics.In [1]:
import statistics as st

1. mean() , median(), mode()

As some other functions are also there.In [2]:
l = [2,3,4,1,7,8,2,3,4,5,1,8,5,6,8,2]

## printing the mean of the data.
print('Mean of data is {}'.format(st.mean(l)))

## printing the median of the data.
print('Median of data is {}'.format(st.median(l)))

## Printing the mode of the data, but here it will generate error because here in this ## data two value are most occuring,hence not able to handle.
print('Mode of the data is {}'.format(st.mode(l)))
Mean of data is 4.3125
Median of data is 4.0
---------------------------------------------------------------------------
StatisticsError                           Traceback (most recent call last)
<ipython-input-2-f297ad04a792> in <module>()
      8 
      9 ## Printing the mode of the data, but here it will generate error because here in this data two value are most occuring,hence not able to handle.
---> 10 print('Mode of the data is {}'.format(st.mode(l)))

~\AppData\Local\Continuum\anaconda2\envs\py35\lib\statistics.py in mode(data)
    472     elif table:
    473         raise StatisticsError(
--> 474                 'no unique mode; found %d equally common values' % len(table)
    475                 )
    476     else:

StatisticsError: no unique mode; found 2 equally common values
In [3]:
## Checking the mode value for another dataset
l1 = [1,2,2,3,4]

## Here it is working fine.
print(st.mode(l1))
2

Measure of spread of data

It covers standard deviation, variance etc. Let’s check.In [4]:
## Checking the standard deviation of above list

## Here printing upto 3 decimal places.
print('%.3f' %st.stdev(l))
2.496
In [5]:
## Checking the variance.
print('%.3f' %st.variance(l))
6.229
Now, you get to know, how to use these functions for statistical analysis of data.