The coefficient of variation

We have seen how the standard deviation can describe how spread is a set of data.
The coefficient of variation (CV) is a standardised measure of dispersion of a probability distribution or frequency distribution. It is defined as the ratio of the standard deviation (sigma) to the mean (mu):

$CV = \sigma / \mu$

It shows the extent of variability in relation to mean of the population.

The coefficient of variation is useful because the standard deviation of data must always be understood in the context of the mean of the data. In contrast, the actual value of the CV is independent of the unit in which the measurement has been taken, so it is a dimensionless number.
For comparison between data sets with different units or widely different means, one should use the coefficient of variation instead of the standard deviation.

In Python (this fragment does make use of previously defined mean and standard deviation functions) is straightforward:

def coeffVar(X):
try:
return stdDev(X) / mean(X)
except ZeroDivisionError:
raise StatsError('mean is zero')