From b51d908bfa5ca1b671154dc3043b4a6a90083653 Mon Sep 17 00:00:00 2001 From: ekatef Date: Wed, 11 Oct 2023 12:27:31 +0300 Subject: [PATCH] Fix computation of the mean --- scripts/build_retro_cost.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build_retro_cost.py b/scripts/build_retro_cost.py index bacb8715..cb3caeff 100644 --- a/scripts/build_retro_cost.py +++ b/scripts/build_retro_cost.py @@ -966,7 +966,8 @@ def sample_dE_costs_area( for ct in set(countries).difference(cost_dE.index.levels[0]): averaged_data = ( cost_dE.reindex(index=map_for_missings[ct], level=0) - .mean(level=1) + .groupby(level=1) + .mean() .set_index(pd.MultiIndex.from_product([[ct], cost_dE.index.levels[1]])) ) cost_dE = pd.concat(cost_dE, averaged_data)