Python statistics module

Python Programming Training Certification

Flexible Hours

100 Assignments

Instructor Led online Training

50 LMS Access

24X7 Support

100% Skill Level

Enquire Now

4.9 out of 1000+ Ratings
Best Python Institute for Learning Python Course & Training, Live Project Training in Python with Django, Data Science and AI, Interview Assistance, Expert Coaching Trainers. Python Certification & Interview Assistance! Get free demo now!

Course Overview

Python is one of the world’s top programming languages used today and Python training has become the most popular training across individuals. Training Basket’s Python Training & Certification course covers basic and advanced Python concepts and how to apply them in real-world applications.Python is a flexible and powerful open-source language that is easy to learn and consists of powerful libraries for data analysis and manipulation. Our Python training course content is curated by experts as per the standard Industry curriculum. The curriculum, coding challenges and real-life problems cover data operations in Python, strings, conditional statements, error handling, shell scripting, web scraping and the commonly used Python web framework Django. Take this Python training and certification course and become job-ready now.

Python statistics module

Python statistics module provides the functions to mathematical statistics of numeric data. There are some popular statistical functions defined in this module.

mean() function

The mean() function is used to calculate the arithmetic mean of the numbers in the list.


  • import statistics
    # list of positive integer numbers
    datasets = [5, 2, 7, 4, 2, 6, 8]
    x = statistics.mean(datasets)
    # Printing the mean
    print(“Mean is :”, x)


  • Mean is : 4.857142857142857

median() function

The median() function is used to return the middle value of the numeric data in the list.


  • import statistics
    datasets = [4, -5, 6, 6, 9, 4, 5, -2]
    # Printing median of the
    # random data-set
    print(“Median of data-set is : % s ”
    % (statistics.median(datasets)))


  • Median of data-set is : 4.5

mode() function

The mode() function returns the most common data that occurs in the list.


  • import statistics
    # declaring a simple data-set consisting of real valued positive integers.
    dataset =[2, 4, 7, 7, 2, 2, 3, 6, 6, 8]
    # Printing out the mode of given data-set
    print(“Calculated Mode % s” % (statistics.mode(dataset)))


  • Calculated Mode 2

stdev() function

The stdev() function is used to calculate the standard deviation on a given sample which is available in the form of the list.


  • import statistics
    # creating a simple data – set
    sample = [7, 8, 9, 10, 11]
    # Prints standard deviation
    print(“Standard Deviation of sample is % s ”
    % (statistics.stdev(sample)))


  • Standard Deviation of sample is 1.5811388300841898


The median_low function is used to return the low median of numeric data in the list.


  • import statistics
    # simple list of a set of integers
    set1 = [4, 6, 2, 5, 7, 7]
    # Note: low median will always be a member of the data-set.
    # Print low median of the data-set
    print(“Low median of data-set is % s ”
    % (statistics.median_low(set1)))


  • Low median of the data-set is 5


The median_high function is used to return the high median of numeric data in the list.


  • import statistics
    # list of set of the integers
    dataset = [2, 1, 7, 6, 1, 9]
    print(“High median of data-set is %s ”
    % (statistics.median_high(dataset)))


  • High median of the data-set is 6

Recently Trained Students

Jessica Biel

– Infosys

My instructor had sound Knowledge and used to puts a lot of effort that made the course as simple and easy as possible. I was aiming for with the help of the ZebLearn Online training imparted to me by this organization.

Richard Harris


I got my training from Zeblearn in the Python Certification Training, I would like to say that say he is one of the best trainers. He has not even trained me but also motivated me to explore more and the way he executed the project, in the end, was mind-blowing.

Candidate’s Journey During Our Training Program

Card image cap

Expert’s Advice & Selection of Module

Choosing the right type of module for the training is half the battle & Our Team of experts will help & guide you.

Card image cap

Get Trained

Get Trained & Learn End to End Implementation from our Expert Trainer who are working on the same domain.

Card image cap

Work on Projects

We Do make our student’s work on multiple case studies , scenario based tasks & projects in order to provide real-time exposure to them.

Card image cap


We have a dedicated placement cell in order to provide placement assistance & relevant interviews to our candididates till selection

Placement Partner


Leave your details


Download Course Content