From 0ac6a6a1f2c07a5ee0ff8696e29de5e615fbbd35 Mon Sep 17 00:00:00 2001 From: lisazeyen <35347358+lisazeyen@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:38:07 +0200 Subject: [PATCH] simplify exclude statement Co-authored-by: Fabian Neumann --- scripts/build_energy_totals.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index 72bc01b5..5fe405a6 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -612,11 +612,8 @@ def build_idees(countries: List[str]) -> pd.DataFrame: # efficiency kgoe/100km -> ktoe/100km so that after conversion TWh/100km totals.loc[:, "passenger car efficiency"] /= 1e6 # convert ktoe to TWh - exclude = ( - totals.columns.str.fullmatch("passenger cars") - ^ totals.columns.str.fullmatch(".*space efficiency") - ^ totals.columns.str.fullmatch(".*water efficiency") - ) + patterns = ["passenger cars", ".*space efficiency", ".*water efficiency"] + exclude = totals.columns.str.fullmatch("|".join(patterns)) totals = totals.copy() totals.loc[:, ~exclude] *= 11.63 / 1e3