Calculating standard deviation of a population using Python

The python function pstdev() returns the square root of the variance of the population as given in the data parameter

Statistics Updated 13 Jan 2017 1 min read

Standard Deviation

The Standard Deviation of the population is given by the square root of Variance.

Method Name

pstdev(data)

Method Overview

The pstdev() function takes a sequence or an iterator containing the population data and returns the Standard Deviation of the population which is the square root of the Variance.

Exceptions

Python raises a StatisticsError if the data passed inside the pstdev() is empty.

Python example program for finding Population Standard Deviation

python
# import the statistics module

import statistics

populationData = [126,122,130,124,121,121,125,132,137,118]

# find Population Standard Deviation

populationSD   = statistics.pstdev(populationData)

print("Standard Deviation of the Population is %.2f"%(populationSD))

Example Python program output that finds Population Standard Deviation

Output
Standard Deviation of the Population is 5.54