benmiroglio / pymatch

MIT License
276 stars 129 forks source link

compare_continuous doesn't work, and compare_categorical get all predictors #36

Open xuy1116 opened 4 years ago

xuy1116 commented 4 years ago

compare_continuous doesn't work, got error below. KeyError: "None of [Index(['var', 'ks_before', 'ks_after', 'grouped_chisqr_before',\n 'grouped_chisqr_after', 'std_median_diff_before',\n 'std_median_diff_after', 'std_mean_diff_before', 'std_mean_diff_after'],\n dtype='object')] are in the [columns]"

But compare_categorical gets to

Capture

all predictors even they are continous variables.

HRK777 commented 4 years ago

facing the exact same issue ... any updates?

dompas commented 4 years ago

I have resolved this issue by changing a part of the code of compare_continuous and compare_categorical on both I stopped using the uf.is_continuousand did exactly the same thing directly on the functions.

is_continuous = (col in self.X.columns) or ("Q('{}')".format(col) in self.X.columns)
if is_continuous and (not(col in self.exclude)):
is_continuous = (col in self.X.columns) or ("Q('{}')".format(col) in self.X.columns)
if (not is_continuous) and (not(col in self.exclude)):
ChristinaMin commented 4 years ago

Thank you dompas! they worked :-)

gjdv commented 2 years ago

I hit some similar behavior and resolved it in pull request #53