scipy.stats.mstats.variation¶
-
scipy.stats.mstats.
variation
(a, axis=0)[source]¶ Computes the coefficient of variation, the ratio of the biased standard deviation to the mean.
- Parameters
- aarray_like
Input array.
- axisint or None, optional
Axis along which to calculate the coefficient of variation. Default is 0. If None, compute over the whole array a.
- Returns
- variationndarray
The calculated variation along the requested axis.
Notes
For more details about
variation
, see stats.variation.Examples
>>> from scipy.stats.mstats import variation >>> a = np.array([2,8,4]) >>> variation(a) 0.5345224838248487 >>> b = np.array([2,8,3,4]) >>> c = np.ma.masked_array(b, mask=[0,0,1,0]) >>> variation(c) 0.5345224838248487
In the example above, it can be seen that this works the same as stats.variation except ‘stats.mstats.variation’ ignores masked array elements.