diff --git a/src/imputation/imputation_main.py b/src/imputation/imputation_main.py index d60f25d84..15a8a0306 100644 --- a/src/imputation/imputation_main.py +++ b/src/imputation/imputation_main.py @@ -106,10 +106,10 @@ def run_imputation( imputed_df = hlp.calculate_totals(imputed_df) # After TMI imputation, overwrite the "604" == "No" in any records with - # Status "check needed" (they are now being imputed) + # Status "check needed" (they are now being imputed") chk_mask = imputed_df["status"].str.contains("Check needed") imputation_mask = imputed_df["imp_marker"] == "TMI" - # Changing all records that meet the criteria to "604" == "Yes" + imputed_df.loc[(chk_mask & imputation_mask), "604"] = "Yes" # join constructed rows back to the imputed df