Average of values in a counter
The statistics
module has a number of useful functions. These are based on having each individual data sample
available for processing. In some cases, however, the data has been grouped into bins. We might have a collections.Counter
object instead of a simple list. Rather than a collection of raw values, we now have a collection of (value, frequency) pairs.
Given frequency information, we can do essential statistical
processing. A summary in the form of (value, frequency) pairs requires less memory than raw data, allowing us to work with larger sets of data.
Getting ready
The general definition of the mean
is the sum of all of the values divided by the number of values. It's often written like this:
We've defined some set of data, C, as a sequence of n
individual values, . The mean
of this collection, , is the sum of the values divided by the number of values, n
.
There's a tiny change in this definition...