Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
olejandro committed Dec 17, 2024
1 parent 321aebd commit 85c82ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion xl2times/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ def model_years(self) -> set[int]:
return self.past_years | set(self.time_periods["m"].values)

@cached_property
# TODO: Invalidate and recompute this property when self.topology changes.
def veda_cgs(self) -> dict[tuple[str, str, str], str]:
"""veda_cgs is a dictionary mapping commodities to their Veda commodity groups."""
"""A dictionary mapping commodities to their Veda commodity groups."""
cols = ["region", "process", "commodity", "csets"]
# Exclude auxillary flows
index = self.topology["io"].isin({"IN", "OUT"})
Expand Down
6 changes: 3 additions & 3 deletions xl2times/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3153,7 +3153,7 @@ def apply_final_fixup(
# Clean up
# TODO: Do this comprehensively for all relevant tables
# TODO: Duplicates should only be removed if in the same file/module
keep_cols = [
keep_cols = {
"attribute",
"region",
"process",
Expand All @@ -3167,11 +3167,11 @@ def apply_final_fixup(
"sow",
"stage",
"module_name",
]
}
df.dropna(subset="value", inplace=True)
drop_cols = [col for col in df.columns if col != "value" and col not in keep_cols]
df.drop(columns=drop_cols, inplace=True)
df = df.drop_duplicates(subset=keep_cols, keep="last")
df = df.drop_duplicates(subset=list(keep_cols), keep="last")
tables[Tag.fi_t] = df.reset_index(drop=True)

return tables
Expand Down

0 comments on commit 85c82ca

Please sign in to comment.