Skip to content

Commit

Permalink
Simplify assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
willu47 committed Jan 25, 2024
1 parent ccb9e35 commit f877a3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/otoole/results/result_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def capital_recovery_factor(
(1 - (1 + DiscountRateIdv[r,t])^(-1))/(1 - (1 + DiscountRateIdv[r,t])^(-(OperationalLife[r,t])));
"""

def calc_crf(df, operational_life):
def calc_crf(df: pd.DataFrame, operational_life: pd.Series) -> pd.Series:
rate = df["VALUE"] + 1
numerator = 1 - rate.pow(-1)
denominator = 1 - rate.pow(-operational_life)
Expand All @@ -793,7 +793,7 @@ def calc_crf(df, operational_life):
crf = discount_rate_idv.reindex(index)
# This is a hack to get around the fact that the discount rate is
# indexed by REGION and not REGION, TECHNOLOGY
crf[::1] = values
crf[:] = values
crf["VALUE"] = calc_crf(crf, operational_life["VALUE"])

return crf.reset_index()[["REGION", "TECHNOLOGY", "VALUE"]].set_index(
Expand Down

0 comments on commit f877a3a

Please sign in to comment.