-
Notifications
You must be signed in to change notification settings - Fork 15
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
Remove fillna call in ArbitraryImputer (Issue 195) #198
Remove fillna call in ArbitraryImputer (Issue 195) #198
Conversation
…BaseImputer.transform to return a dataframe instead of an int
This looks good to me RJ, looks like there are just a couple of ruff things failing in CI - could you fix those and then will approve? :) |
Hi Liam, the ruff linting errors seem to be from tests/imputers/test_BaseImputer.py due to using np.NaN rather than np.nan. I have made this replacement now and all the checks are passing :) |
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.
Great, thanks RJ - approved!
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.
actually just realised, can you please update the changelog :)
Done! Have a look at the changelog and let me know if it's fine :) |
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.
great thank you - approved again :)
ArbitraryImputer was calling fillna both in it's own transform method, and in the BaseImputer method.
To increase tubular's efficiency and maintainability, have removed fillna call in ArbitraryImputer and moved the logic for "casting imputer value as same dtype as original column" below the BaseImputer.transform call.
Note that the above change caused the test_impute_values_set in test_ArbitraryImputer.py to fail since the initial mock setup for BaseImputer.transform was returning a simple integer:1234. However, this causes 'TypeError: 'int' object is not superscriptable' for the following code line in transform method of ArbitraryImputer: X_transformed[c] = X_transformed[c].astype(dtype), since an integer cannot be treated as a collection. Therefore have updated test_impute_values_set to mock BaseImputer.transform to return a dataframe rather than an int