npstreams.iaverage(arrays, axis=-1, weights=None, ignore_nan=False)

Streaming (weighted) average of arrays.

  • arrays (iterable of ndarrays) – Arrays to be averaged. This iterable can also a generator.

  • axis (int, optional) – Reduction axis. Default is to average the arrays in the stream as if they had been stacked along a new axis, then average along this new axis. If None, arrays are flattened before averaging. If axis is an int larger that the number of dimensions in the arrays of the stream, arrays are averaged along the new axis.

  • weights (iterable of ndarray, iterable of floats, or None, optional) – Iterable of weights associated with the values in each item of arrays. Each value in an element of arrays contributes to the average according to its associated weight. The weights array can either be a float or an array of the same shape as any element of arrays. If weights=None, then all data in each element of arrays are assumed to have a weight equal to one.

  • ignore_nan (bool, optional) – If True, NaNs are set to zero weight. Default is propagation of NaNs.


avg (~numpy.ndarray, dtype float) – Weighted average.

See also


streaming array mean (non-weighted average).