From 53adee17b2ac2f5ef1df81d7bec5f6bccb2c5a1a Mon Sep 17 00:00:00 2001 From: Roland Stevenson Date: Fri, 1 Dec 2023 18:59:49 +0100 Subject: [PATCH] remove .bool() --- causalml/metrics/visualize.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/causalml/metrics/visualize.py b/causalml/metrics/visualize.py index 232854fa..1df41ea4 100644 --- a/causalml/metrics/visualize.py +++ b/causalml/metrics/visualize.py @@ -78,11 +78,11 @@ def get_cumlift( (pandas.DataFrame): average uplifts of model estimates in cumulative population """ assert ( - (outcome_col in df.columns and df[[outcome_col]].notnull().all().bool()) - and (treatment_col in df.columns and df[[treatment_col]].notnull().all().bool()) + (outcome_col in df.columns and df[[outcome_col]].notnull().all()) + and (treatment_col in df.columns and df[[treatment_col]].notnull().all()) or ( treatment_effect_col in df.columns - and df[[treatment_effect_col]].notnull().all().bool() + and df[[treatment_effect_col]].notnull().all() ) ) @@ -216,11 +216,11 @@ def get_qini( (pandas.DataFrame): cumulative gains of model estimates in population """ assert ( - (outcome_col in df.columns and df[[outcome_col]].notnull().all().bool()) - and (treatment_col in df.columns and df[[treatment_col]].notnull().all().bool()) + (outcome_col in df.columns and df[[outcome_col]].notnull().all()) + and (treatment_col in df.columns and df[[treatment_col]].notnull().all()) or ( treatment_effect_col in df.columns - and df[[treatment_effect_col]].notnull().all().bool() + and df[[treatment_effect_col]].notnull().all() ) ) @@ -315,9 +315,9 @@ def get_tmlegain( (pandas.DataFrame): cumulative gains of model estimates based of TMLE """ assert ( - (outcome_col in df.columns and df[[outcome_col]].notnull().all().bool()) - and (treatment_col in df.columns and df[[treatment_col]].notnull().all().bool()) - or (p_col in df.columns and df[[p_col]].notnull().all().bool()) + (outcome_col in df.columns and df[[outcome_col]].notnull().all()) + and (treatment_col in df.columns and df[[treatment_col]].notnull().all()) + or (p_col in df.columns and df[[p_col]].notnull().all()) ) inference_col = [x for x in inference_col if x in df.columns] @@ -421,9 +421,9 @@ def get_tmleqini( (pandas.DataFrame): cumulative gains of model estimates based of TMLE """ assert ( - (outcome_col in df.columns and df[[outcome_col]].notnull().all().bool()) - and (treatment_col in df.columns and df[[treatment_col]].notnull().all().bool()) - or (p_col in df.columns and df[[p_col]].notnull().all().bool()) + (outcome_col in df.columns and df[[outcome_col]].notnull().all()) + and (treatment_col in df.columns and df[[treatment_col]].notnull().all()) + or (p_col in df.columns and df[[p_col]].notnull().all()) ) inference_col = [x for x in inference_col if x in df.columns]