Skip to content

Commit e3ec3bb

Browse files
committed
Quicker merge_flows_to_self
1 parent e3f3bbc commit e3ec3bb

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

activity_browser/bwutils/superstructure/manager.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,7 @@ def merge_flows_to_self(df: pd.DataFrame) -> pd.DataFrame:
276276
-------
277277
A pandas dataframe with the changes made to the scenario dataframe for these self referential flows
278278
"""
279-
self_referential_production_flows = df.loc[
280-
df.apply(
281-
lambda x: (
282-
True
283-
if x["from key"] == x["to key"] and x["flow type"] == "technosphere"
284-
else False
285-
),
286-
axis=1,
287-
),
288-
:,
289-
].copy()
279+
self_referential_production_flows = df[(df["from key"] == df["to key"]) & (df["flow type"] == "technosphere")].copy()
290280
self_referential_production_flows.index = pd.MultiIndex.from_arrays(
291281
[
292282
self_referential_production_flows.index.get_level_values(0),

0 commit comments

Comments
 (0)