From 1bb13ad7acda2f712f3459cc521db8b19d755d43 Mon Sep 17 00:00:00 2001 From: Farhad Allian Date: Tue, 30 Jul 2024 10:52:58 +0100 Subject: [PATCH 1/2] Fix: FutureWarningErrors in Pandas v > 2 --- causal_testing/testing/estimators.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/causal_testing/testing/estimators.py b/causal_testing/testing/estimators.py index 5133744b..d0c31b25 100644 --- a/causal_testing/testing/estimators.py +++ b/causal_testing/testing/estimators.py @@ -382,6 +382,10 @@ def estimate_ate(self) -> tuple[pd.Series, list[pd.Series, pd.Series]]: # Create an empty individual for the control and treated individuals = pd.DataFrame(1, index=["control", "treated"], columns=model.params.index) + + + # For Pandas version > 2, we need to explicitly state that the dataframe takes floating-point values + individuals = individuals.astype(float) # It is ABSOLUTELY CRITICAL that these go last, otherwise we can't index # the effect with "ate = t_test_results.effect[0]" From 5af464fd328a49122c9775e25fa6c5771b0a5a42 Mon Sep 17 00:00:00 2001 From: Farhad Allian Date: Tue, 30 Jul 2024 13:30:43 +0100 Subject: [PATCH 2/2] fix: lint --- causal_testing/testing/estimators.py | 1 - 1 file changed, 1 deletion(-) diff --git a/causal_testing/testing/estimators.py b/causal_testing/testing/estimators.py index d0c31b25..fdd834bc 100644 --- a/causal_testing/testing/estimators.py +++ b/causal_testing/testing/estimators.py @@ -382,7 +382,6 @@ def estimate_ate(self) -> tuple[pd.Series, list[pd.Series, pd.Series]]: # Create an empty individual for the control and treated individuals = pd.DataFrame(1, index=["control", "treated"], columns=model.params.index) - # For Pandas version > 2, we need to explicitly state that the dataframe takes floating-point values individuals = individuals.astype(float)