Calculating standard deviation of a population using Python

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:

# 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:

Standard Deviation of the Population is 5.54

 


Copyright 2024 © pythontic.com