Skip to content

Fix drtester dataframe#1025

Open
michaelellis003 wants to merge 2 commits intopy-why:mainfrom
michaelellis003:fix-drtester-dataframe
Open

Fix drtester dataframe#1025
michaelellis003 wants to merge 2 commits intopy-why:mainfrom
michaelellis003:fix-drtester-dataframe

Conversation

@michaelellis003
Copy link
Copy Markdown

DRTester.fit_nuisance fails when passed pandas DataFrames because fit_nuisance_cv uses numpy-style integer array indexing (X[train]) with the index arrays from StratifiedKFold.split(). Pandas interprets these as column selection, causing a KeyError.

This adds input conversion at the top of fit_nuisance using check_input_arrays, consistent with how other estimators in the package handle this (e.g., _OrthoLearner.fit).

Fixes #852

Copy link
Copy Markdown
Member

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Signed-off-by: Michael Ellis <michaelellis003@gmail.com>
Signed-off-by: Michael Ellis <michaelellis003@gmail.com>
@kbattocchi kbattocchi force-pushed the fix-drtester-dataframe branch from bdabd7c to fdcc2f5 Compare April 10, 2026 18:01
@kbattocchi kbattocchi enabled auto-merge (rebase) April 10, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DRtester error either with CausalForestDML or with pandas dataframes (or both?) ?

2 participants