-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[data/preprocessors] do not fail transform_batch on missing column #48137
[data/preprocessors] do not fail transform_batch on missing column #48137
Conversation
@@ -113,6 +125,8 @@ def test_simple_imputer(): | |||
|
|||
assert constant_out_df.equals(constant_expected_df) | |||
|
|||
# |
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.
cleanup?
@@ -131,7 +131,14 @@ def _transform_pandas(self, df: pd.DataFrame): | |||
if is_categorical_dtype(df.dtypes[column]): | |||
df[column] = df[column].cat.add_categories(value) | |||
|
|||
df = df.fillna(new_values) | |||
for column_name in new_values: |
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 you add this behavior to the docstring as well?
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.
done!
cb46a3d
to
29a1ffc
Compare
@@ -13,7 +13,8 @@ | |||
|
|||
@PublicAPI(stability="alpha") | |||
class SimpleImputer(Preprocessor): | |||
"""Replace missing values with imputed values. | |||
"""Replace missing values with imputed values. If the column is missing from a | |||
batch, it will be filled with the imputed valuegit. |
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.
Nit: valuegit
to value
Signed-off-by: Martin Bomio <martinbomio@gmail.com>
29a1ffc
to
ef5d192
Compare
@omatthew98 @richardliaw would you mind merging, I can't |
…ay-project#48137) Signed-off-by: JP-sDEV <jon.pablo80@gmail.com>
…ay-project#48137) Signed-off-by: mohitjain2504 <mohit.jain@dream11.com>
Why are these changes needed?
Related issue number
Closes #48047
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.