From f877a3a47d4043a7ee1c03da445a48af02eb8589 Mon Sep 17 00:00:00 2001 From: Will Usher Date: Thu, 25 Jan 2024 12:56:38 +0100 Subject: [PATCH] Simplify assignment --- src/otoole/results/result_package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/otoole/results/result_package.py b/src/otoole/results/result_package.py index a393fec..a63de92 100644 --- a/src/otoole/results/result_package.py +++ b/src/otoole/results/result_package.py @@ -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) @@ -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(