Skip to content

Commit b6ce637

Browse files
authored
Merge pull request #288 from CITCOM-project/update-surrogate-tests
Fixing FutureWarningErrors in Pandas v > 2
2 parents 1e75b70 + 5af464f commit b6ce637

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

causal_testing/testing/estimators.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ def estimate_ate(self) -> tuple[pd.Series, list[pd.Series, pd.Series]]:
383383
# Create an empty individual for the control and treated
384384
individuals = pd.DataFrame(1, index=["control", "treated"], columns=model.params.index)
385385

386+
# For Pandas version > 2, we need to explicitly state that the dataframe takes floating-point values
387+
individuals = individuals.astype(float)
388+
386389
# It is ABSOLUTELY CRITICAL that these go last, otherwise we can't index
387390
# the effect with "ate = t_test_results.effect[0]"
388391
individuals.loc["control", [self.treatment]] = self.control_value

0 commit comments

Comments
 (0)