diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index 2f4f29b6..f40d7e1a 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -842,7 +842,7 @@ def rescale_idees_from_eurostat( "total": [ "total agriculture heat", "total agriculture machinery", - "total agriculture", # = sum of all other agriculture categories + "total agriculture", ], "elec": [ "total agriculture electricity", @@ -850,10 +850,11 @@ def rescale_idees_from_eurostat( }, "Road": { "total": [ - "total road", # = sum of all other road categories + "total road", "total passenger cars", "total other road passenger", "total light duty road freight", + "total heavy duty road freight", ], "elec": [ "electricity road", @@ -941,31 +942,21 @@ def rescale_idees_from_eurostat( energy.loc[slicer_source, navigation].squeeze(axis=0), ).values - # set the total of agriculture/road to the sum of all agriculture/road categories (corresponding to the IDEES data) - energy.loc[country, "total agriculture"] = energy.loc[ - country, - [ + # set the total of agriculture/road to the sum of all agriculture/road categories (corresponding to the IDEES data) + sel = [ "total agriculture electricity", "total agriculture heat", "total agriculture machinery", - ], - ].sum(axis=1) - - energy.loc[country, "total road"] = ( - energy[ - [ - "total passenger cars", - "total other road passenger", - "total light duty road freight", - "electricity road", - "electricity passenger cars", - "electricity other road passenger", - "electricity light duty road freight", - ] ] - .loc[country, :] - .sum(axis=1) - ) + energy.loc[country, "total agriculture"] = energy.loc[country, sel].sum(axis=1) + + sel = [ + "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) return energy