From 9ce214ccee01f7c6d55c289e39413ce2522fd60c Mon Sep 17 00:00:00 2001 From: Jing Pan Date: Tue, 14 Nov 2023 15:57:46 -0800 Subject: [PATCH] fix missing value bug --- causalml/metrics/visualize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/causalml/metrics/visualize.py b/causalml/metrics/visualize.py index e6b9b226..a2923a09 100644 --- a/causalml/metrics/visualize.py +++ b/causalml/metrics/visualize.py @@ -114,10 +114,10 @@ def get_cumlift( sorted_df["cumsum_ct"] = sorted_df.index.values - sorted_df["cumsum_tr"] sorted_df["cumsum_y_tr"] = ( sorted_df[outcome_col] * sorted_df[treatment_col] - ).cumsum() + ).fillna(0).cumsum(skipna=True).astype(float) sorted_df["cumsum_y_ct"] = ( sorted_df[outcome_col] * (1 - sorted_df[treatment_col]) - ).cumsum() + ).fillna(0).cumsum(skipna=True).astype(float) lift.append( sorted_df["cumsum_y_tr"] / sorted_df["cumsum_tr"]