A major part of python programing has to do with statistics, or at least it would seem that is the area of python where the language is used the most. So of course there is a built in library that has to do with statistics that has all the usual methods that I would expect in such a library that have to do with the basic stuff at least when it comes to an arithmetic average, median, and mode of a set of numbers. I use the term arithmetic average to refer to what many may regard as the normal average where the sum of numbers is divided over the number of numbers because there is more than one average method in this library.
In the statistics library there is not one but several functions for getting a mean or average as it is often called. The mean method will give what is called an arithmetic mean, but there is also a harmonic mean in addition to this. When it comes to the three Pythagorean means there is also a geometric mean, in this post I was using python 3.7 and in that version of python there is no geometric mean so I had to come up with one. In late versions of the python the statistics library does also have this type of mean also.
A basic arithmetic mean, or average if you prefer is what many of us become aware of in school, and it is also the typical average that I often use in various projects. Just add up all the numbers in a collection of numbers into a sum, and divide that sum over the number of numbers. In the python statistics library the mean method is this kind of average.
A harmonic mean differs a little from an arithmetic mean.
When it comes to a geometric mean one will need to be added as the function is not part of the statistics library for python versions 3.7 and lower. However in late versions of python it is indeed there and as such coming up with something like this is not needed.
There is also getting the median of a set of numbers. The main median function will just return the median number in a data set, or the arithmetic average of the center two numbers.
The subject of standard deviation will come up now and then when dealing with a set of numbers which is a way of going about measure the variance between a set of numbers. For example the numbers 50, 51, and 49 are all pretty near each other while the numbers 100, 10, and 45 not so much. So it would make sense to have methods that can be used to gauge this kind of magnitude. In the python statistics library there are a few methods that can be used to get this kind of value such like that of an average.
There is a population variance function, that differs from the regular sample variance function.
There are two forms of Standard deviation which include population and sample forms. The sample standard deviation is just the square root of the sample variance.