-
Notifications
You must be signed in to change notification settings - Fork 915
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
Allow fillna
to validate for CategoricalColumn.fillna
#15683
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -762,10 +762,17 @@ def fillna( | |
else: | ||
replace_val = None | ||
should_fill = ( | ||
col_name in value | ||
and col.has_nulls(include_nan=True) | ||
and not libcudf.scalar._is_null_host_scalar(replace_val) | ||
) or method is not None | ||
( | ||
col_name in value | ||
and col.has_nulls(include_nan=True) | ||
and not libcudf.scalar._is_null_host_scalar(replace_val) | ||
) | ||
or method is not None | ||
or ( | ||
isinstance(col, cudf.core.column.CategoricalColumn) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: This special-cases categorical columns for fillna both to not care about whether the column has nulls and whether the column name is in the provided dict-like (?) of values. It so happens that the Do you want to just provide a carve-out for categorical columns in the first condition as:
? |
||
and not libcudf.scalar._is_null_host_scalar(replace_val) | ||
) | ||
) | ||
if should_fill: | ||
filled_data[col_name] = col.fillna(replace_val, method) | ||
else: | ||
|
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: this comment suggests that validation of the value must still be performed. But I think it has been in the code above.
So perhaps
WDYT?