Skip to main content

average

Function average 

Source
pub fn average<T: Float + Clone + Zero + NumCast + Send + Sync>(
    a: &Array<T>,
    weights: Option<&Array<T>>,
    axis: Option<usize>,
    returned: Option<bool>,
) -> Result<Array<T>>
Expand description

Calculate a weighted average of array elements

§Parameters

  • a - Input array
  • weights - Optional weights for each value
  • axis - Optional axis along which to average
  • returned - If True, also return the sum of weights

§Returns

The weighted average or (average, sum of weights) if returned is true