From a60e6fca55b85fa95c75b9dbffd6f20cbd678f04 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sat, 25 May 2024 18:02:56 +0200 Subject: [PATCH] bugfix: ensure separately calculated sums are entered (follow-up to #990) --- scripts/build_energy_totals.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index 38137973..fff95733 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -940,20 +940,21 @@ def rescale_idees_from_eurostat( ).values # set the total of agriculture/road to the sum of all agriculture/road categories (corresponding to the IDEES data) - sel = [ + rows = idx[country, :] + cols = [ "total agriculture electricity", "total agriculture heat", "total agriculture machinery", ] - energy.loc[country, "total agriculture"] = energy.loc[country, sel].sum(axis=1) + energy.loc[rows, "total agriculture"] = energy.loc[rows, cols].sum(axis=1) - sel = [ + cols = [ "total passenger cars", "total other road passenger", "total light duty road freight", "total heavy duty road freight", ] - energy.loc[country, "total road"] = energy.loc[country, sel].sum(axis=1) + energy.loc[rows, "total road"] = energy.loc[rows, cols].sum(axis=1) return energy