edges_analysis.averaging.averaging.weighted_mean¶
- edges_analysis.averaging.averaging.weighted_mean(data, weights=None, axis=0)[source]¶
A careful weighted mean where zero-weights don’t error.
In this function, if the total weight is zero, np.nan is returned.
- Parameters:
data (array-like) – The data over which the weighted mean is to be taken.
weights (array-like, optional) – Same shape as data, giving the weights of each datum.
axis (int, optional) – The axis over which to take the mean.
- Returns:
array-like – The weighted mean over axis, where elements with zero total weight are set to nan.