-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed bug where PerColumnImputer cannot handle dropped columns #855
Conversation
Codecov Report
@@ Coverage Diff @@
## master #855 +/- ##
=======================================
Coverage 99.69% 99.69%
=======================================
Files 195 195
Lines 7930 7962 +32
=======================================
+ Hits 7906 7938 +32
Misses 24 24
Continue to review full report at Codecov.
|
@@ -50,7 +51,7 @@ def fit(self, X, y=None): | |||
strategy_dict = self.impute_strategies.get(column, dict()) | |||
strategy = strategy_dict.get('impute_strategy', self.default_impute_strategy) | |||
fill_value = strategy_dict.get('fill_value', None) | |||
self.imputers[column] = SkImputer(strategy=strategy, fill_value=fill_value) | |||
self.imputers[column] = SimpleImputer(impute_strategy=strategy, fill_value=fill_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than use SkImputer
, I'm using our SimpleImputer
which already handles the nan's from the previous PR :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯 oh, great idea!! Modularity always wins 👍😁
@@ -67,8 +68,14 @@ def transform(self, X, y=None): | |||
pd.DataFrame: Transformed X | |||
""" | |||
X_t = X.copy() | |||
cols_to_drop = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't set column to empty dataframe, so updating to check first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! 🚢
@@ -50,7 +51,7 @@ def fit(self, X, y=None): | |||
strategy_dict = self.impute_strategies.get(column, dict()) | |||
strategy = strategy_dict.get('impute_strategy', self.default_impute_strategy) | |||
fill_value = strategy_dict.get('fill_value', None) | |||
self.imputers[column] = SkImputer(strategy=strategy, fill_value=fill_value) | |||
self.imputers[column] = SimpleImputer(impute_strategy=strategy, fill_value=fill_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯 oh, great idea!! Modularity always wins 👍😁
Closes #514 by addressing PerColumnImputer