scipp.nanmean(x, dim=None)#

Arithmetic mean of elements in the input ignoring NaN’s.

If the input has variances, the variances stored in the output are based on the “standard deviation of the mean”, i.e., \(\sigma_{mean} = \sigma / \sqrt{N}\). \(N\) is the length of the input dimension. \(\sigma\) is estimated as the average of the standard deviations of the input elements along that dimension.

See scipp.sum() on how rounding errors for float32 inputs are handled.

  • x (scipp.typing.VariableLike) – Input data.

  • dim (Optional[str], default: None) – Dimension along which to calculate the mean. If not given, the nanmean over all dimensions is calculated.


Same type as x – The mean of the input values which are not NaN.

See also


Compute the variance, ignoring NaN’s.


Compute the standard deviation, ignoring NaN’s.


Compute the mean without special handling of NaN.