Skip to content

Commit

Permalink
Merge pull request #288 from CITCOM-project/update-surrogate-tests
Browse files Browse the repository at this point in the history
Fixing FutureWarningErrors in Pandas v > 2
  • Loading branch information
f-allian authored Jul 30, 2024
2 parents 1e75b70 + 5af464f commit b6ce637
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions causal_testing/testing/estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ 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]"
individuals.loc["control", [self.treatment]] = self.control_value
Expand Down

0 comments on commit b6ce637

Please sign in to comment.