From ad800209023ea8d88be15bf1746ea9db184ebbb9 Mon Sep 17 00:00:00 2001 From: Jan Meyer Date: Tue, 26 Sep 2023 14:55:39 +0200 Subject: [PATCH] Accessing the correct column for weighted average (#131) Co-authored-by: Jan --- meteostat/utilities/aggregations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meteostat/utilities/aggregations.py b/meteostat/utilities/aggregations.py index 9845828..6740d1f 100644 --- a/meteostat/utilities/aggregations.py +++ b/meteostat/utilities/aggregations.py @@ -18,7 +18,7 @@ def weighted_average(step: pd.DataFrame) -> pd.DataFrame: """ data = np.ma.masked_array(step, np.isnan(step)) - data = np.ma.average(data, axis=0, weights=data[:, -1]) + data = np.ma.average(data, axis=0, weights=data[:, -2]) data = data.filled(np.NaN) return pd.DataFrame(data=[data], columns=step.columns)