simplify exclude statement

Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
This commit is contained in:
lisazeyen 2024-09-11 09:38:07 +02:00 committed by GitHub
parent 649e48e1a9
commit 0ac6a6a1f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -612,11 +612,8 @@ def build_idees(countries: List[str]) -> pd.DataFrame:
# efficiency kgoe/100km -> ktoe/100km so that after conversion TWh/100km # efficiency kgoe/100km -> ktoe/100km so that after conversion TWh/100km
totals.loc[:, "passenger car efficiency"] /= 1e6 totals.loc[:, "passenger car efficiency"] /= 1e6
# convert ktoe to TWh # convert ktoe to TWh
exclude = ( patterns = ["passenger cars", ".*space efficiency", ".*water efficiency"]
totals.columns.str.fullmatch("passenger cars") exclude = totals.columns.str.fullmatch("|".join(patterns))
^ totals.columns.str.fullmatch(".*space efficiency")
^ totals.columns.str.fullmatch(".*water efficiency")
)
totals = totals.copy() totals = totals.copy()
totals.loc[:, ~exclude] *= 11.63 / 1e3 totals.loc[:, ~exclude] *= 11.63 / 1e3