SciPy

scipy.stats.nanmean

scipy.stats.nanmean(*args, **kwds)[source]

nanmean is deprecated! scipy.stats.nanmean is deprecated in scipy 0.15.0 in favour of numpy.nanmean.

Compute the mean over the given axis ignoring nans.
Parameters:

x : ndarray

Input array.

axis : int, optional

Axis along which the mean is computed. Default is 0, i.e. the first axis.

Returns:

m : float

The mean of x, ignoring nans.

Examples

>>> from scipy import stats
>>> a = np.linspace(0, 4, 3)
>>> a
array([ 0.,  2.,  4.])
>>> a[-1] = np.nan
>>> stats.nanmean(a)
1.0

Previous topic

scipy.stats.tsem

Next topic

scipy.stats.nanstd