archetypal.utils.weighted_mean
- archetypal.utils.weighted_mean(series, df, weighting_variable)[source]
Compute the weighted average while ignoring NaNs. Implements
numpy.average()
.- Parameters
series (pandas.Series) – the series on which to compute the mean.
df (pandas.DataFrame) – the df containing weighting variables.
weighting_variable (str or list or tuple) – Name of weights to use in df. If multiple values given, the values are multiplied together.
- Returns
the weighted average
- Return type