From 128e1afc0072ddb21d01ce58137e3823f81f7c4e Mon Sep 17 00:00:00 2001 From: Julian Geis Date: Fri, 19 Jan 2024 10:01:11 +0100 Subject: [PATCH] Update scripts/prepare_sector_network.py Co-authored-by: Fabian Neumann --- scripts/prepare_sector_network.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 292814b2..4c47b91a 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -1333,9 +1333,7 @@ def add_storage_and_grids(n, costs): h2_pipes = pd.concat([h2_pipes, custom_pipes]) # drop duplicates according to buses (order can be different) and keep pipe with highest p_nom - h2_pipes["buses_sorted"] = h2_pipes.apply( - lambda row: tuple(sorted([row["bus0"], row["bus1"]])), axis=1 - ) + h2_pipes["buses_sorted"] = h2_pipes[["bus0", "bus1"]].apply(sorted, axis=1) h2_pipes = ( h2_pipes.sort_values("p_nom") .drop_duplicates(subset=["buses_sorted"], keep="last")