Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Python – Find Data Population Variance – pvariance() Function with Examples

pvariance() function is used to find the population variance of data in Python. It calculate the variance from the entire population.

 

Syntax of pvariance() Function

The syntax of pvariance() function in Python is:

If data is empty StatisticsError raises.

 

Parameters of pvariance() Function in Python

data – Where data is array of valid Python numbers including Decimal and Fraction values. This parameter is required.
mu – Where mu is the mean of data. This parameter is optional. If this parameter is not given(none) then the mean is automatically calculated.

 

Compatibility

pvariance() function is only available and compatible with Python 3.x.

 

Return Value of pvariance() Function in Python

pvariance() function returns the population variance of data which is a non-empty iterable of real-valued numbers for the given input (Data array).

 

Python pvariance() Function Simple Example


Output:
114866.24489795919

 

Python pvariance() Example with both Arguments

Calculate mean first and pass it as an argument.

Output:
5049.222222222222

 

Python pvariance() Function Example of Decimals

Use decimal array as an argument.

Output:
1454201.894819034722222222222

 

Python pvariance() Function Example of Fraction

Use Fraction array as an argument.

Output:
337/768

Loading...
LearnAndLearn.com © 2018 - All rights reserved