Online Courses

Statistics with Python
Using the math library you can get various statistical values. We start by creating a list of values:

import math

x = [1,2,15,3,6,17,8,16,8,3,10,12,16,12,9]

Five number summary
We can get the five number summary using the math library. The five number summary contains:  minimum, maximum, median, mean and the standard deviation.

import math
import numpy

x = [1,2,15,3,6,17,8,16,8,3,10,12,16,12,9]


This code will create a boxplot:

import matplotlib.pyplot as plt
import numpy as np

x = [1,2,15,3,6,17,8,16,8,3,10,12,16,12,9]


Regular expressions
Python Socket Client (Network)

6 thoughts on “Statistics

  1. Reply
    Andre - February 11, 2016

    Traceback (most recent call last):
    File “/home/andre/”, line 4, in
    import matplotlib.pyplot as plt
    ImportError: No module named matplotlib.pyplot

    1. Reply
      admin - February 14, 2016

      Hi Andre, install the module matplotlib using pip.

  2. Reply
    Camilo - April 8, 2016

    Excuse me, whats the meaning of the plot? why that shape like a piston?

    1. Reply
      admin - April 12, 2016

      plot is a module that contains graphical functions. We call boxplot() which creates that particular shape.
      Have a look at for more graphics

  3. Reply
    Salhi Fadhel - May 14, 2016

    I am newbie and I am using windows 32, I got the error below
    Traceback (most recent call last):
    File “C:/Users/ELTE/Desktop/python/”, line 2, in
    import numpy
    ImportError: No module named ‘numpy’

    1. Reply
      admin - May 17, 2016

      You are missing the module ‘numpy’.
      There are unofficial window binaries for the numpy module:

Leave a Reply

Your email address will not be published. Required fields are marked *