From dda0c98b2833adb21424cdfd57d9af81774eadf4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:05:17 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/build_energy_totals.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index fcba5b4d..5bcd2695 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", # = sum of all other agriculture categories ], "elec": [ "total agriculture electricity", @@ -850,7 +850,7 @@ def rescale_idees_from_eurostat( }, "Road": { "total": [ - "total road", # = sum of all other road categories + "total road", # = sum of all other road categories "total passenger cars", "total other road passenger", "total light duty road freight", @@ -942,15 +942,30 @@ 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) - energy.loc[country, "total agriculture"] = energy.loc[country, ["total agriculture electricity", "total agriculture heat", "total agriculture machinery"]].sum(axis=1) + energy.loc[country, "total agriculture"] = energy.loc[ + country, + [ + "total agriculture electricity", + "total agriculture heat", + "total agriculture machinery", + ], + ].sum(axis=1) - energy.loc[country, :]["total road"] = energy[["total passenger cars", + 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) + "electricity light duty road freight", + ] + ] + .loc[country, :] + .sum(axis=1) + ) return energy