Previous topic

numpy.ma.cumprod

Next topic

numpy.ma.median

This is documentation for an old release of NumPy (version 1.13). Read this page in the documentation of the latest stable release (version 2.2).

numpy.ma.mean

numpy.ma.mean(self, axis=None, dtype=None, out=None, keepdims=<class numpy._globals._NoValue at 0x40b9ccec>) = <numpy.ma.core._frommethod instance>

Returns the average of the array elements along given axis.

Masked entries are ignored, and result elements which are not finite will be masked.

Refer to numpy.mean for full documentation.

See also

ndarray.mean
corresponding function for ndarrays
numpy.mean
Equivalent function
numpy.ma.average
Weighted average.

Examples

>>> a = np.ma.array([1,2,3], mask=[False, False, True])
>>> a
masked_array(data = [1 2 --],
             mask = [False False  True],
       fill_value = 999999)
>>> a.mean()
1.5