Skip to content

Commit f069791

Browse files
committed
Fixed CF-filtering
1 parent dd71131 commit f069791

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

activity_browser/bwutils/multilca.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,15 +648,14 @@ def _build_inventory(
648648
data.columns = Contributions.get_labels(columns, max_length=30)
649649

650650
data = pd.merge(
651-
AB_metadata.dataframe[fields + ["id"]], data, right_index=True, left_on="id", how="right"
651+
AB_metadata.dataframe[fields], data, right_index=True, left_on="id", how="right"
652652
)
653653
data.reset_index(inplace=True, drop=True)
654-
data.drop(columns="id", inplace=True)
655654

656655
return data
657656

658657
def inventory_df(
659-
self, inventory_type: str, columns: set = {"name", "database", "code"}
658+
self, inventory_type: str, columns: set = {"name", "database", "code", "id"}
660659
) -> pd.DataFrame:
661660
"""Return an inventory dataframe with metadata of the given type."""
662661
try:

activity_browser/layouts/pages/lca_results/LCA_results.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,7 @@ def elementary_flows_contributing_to_IA_methods(
613613
flows = (
614614
set(self.parent.contributions.inventory_data["biosphere"][1].values())
615615
).difference(incl_flows)
616-
new_flows = [flow[1] for flow in flows]
617-
618-
return data.loc[data["code"].isin(new_flows)]
616+
return data.loc[data["id"].isin(flows)]
619617

620618
def update_table(self):
621619
"""Update the table."""
@@ -661,9 +659,9 @@ def clear_tables(self) -> None:
661659
"""Set the biosphere and technosphere to None."""
662660
self.df_biosphere, self.df_technosphere = None, None
663661

664-
def _update_table(self, table: pd.DataFrame, drop: str = "code"):
662+
def _update_table(self, table: pd.DataFrame, drop: tuple = ("code", "id")):
665663
"""Update the table."""
666-
self.table.model.sync((table.drop(drop, axis=1)).reset_index(drop=True))
664+
self.table.model.sync((table.drop(list(drop), axis=1)).reset_index(drop=True))
667665

668666

669667
class LCAResultsTab(NewAnalysisTab):

0 commit comments

Comments
 (0)