Skip to content

Commit

Permalink
pass parameter_to_change to cost aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
joAschauer committed Nov 23, 2023
1 parent f67d0b5 commit 4135ef9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/ptxboa_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,20 @@ def calculate_results_list(
res_list.append(res_single)
res_details = pd.concat(res_list)

return aggregate_costs(res_details)
return aggregate_costs(res_details, parameter_to_change)


def aggregate_costs(res_details: pd.DataFrame) -> pd.DataFrame:
def aggregate_costs(
res_details: pd.DataFrame, parameter_to_change: str
) -> pd.DataFrame:
"""Aggregate detailed costs."""
# Exclude levelized costs:
res = res_details.loc[res_details["cost_type"] != "LC"]
res = res.pivot_table(
index="region", columns="process_type", values="values", aggfunc="sum"
index=parameter_to_change,
columns="process_type",
values="values",
aggfunc="sum",
)
# calculate total costs:
res["Total"] = res.sum(axis=1)
Expand Down

0 comments on commit 4135ef9

Please sign in to comment.