SciPy

scipy.stats.variation

scipy.stats.variation(a, axis=0, nan_policy='propagate')[source]

Compute the coefficient of variation, the ratio of the biased standard deviation to the mean.

Parameters:
a : array_like

Input array.

axis : int or None, optional

Axis along which to calculate the coefficient of variation. Default is 0. If None, compute over the whole array a.

nan_policy : {‘propagate’, ‘raise’, ‘omit’}, optional

Defines how to handle when input contains nan. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default is ‘propagate’.

Returns:
variation : ndarray

The calculated variation along the requested axis.

References

[1]Zwillinger, D. and Kokoska, S. (2000). CRC Standard Probability and Statistics Tables and Formulae. Chapman & Hall: New York. 2000.

Examples

>>> from scipy.stats import variation
>>> variation([1, 2, 3, 4, 5])
0.47140452079103173

Previous topic

scipy.stats.tsem

Next topic

scipy.stats.find_repeats