-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Support pandas nullable types. #7760
Conversation
nullable_alias = {"Int16", "Int32", "Int64"} | ||
|
||
# dtype: pd.core.arrays.numeric.NumericDtype | ||
def is_nullable_dtype(dtype: Any) -> bool: |
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.
Why is this function needed?
It does not seem to make any difference when the same types are in _pandas_dtype_mapper
.
@@ -293,6 +316,9 @@ def _transform_pandas_df( | |||
.cat.codes.astype(np.float32) | |||
.replace(-1.0, np.NaN) | |||
) | |||
elif is_nullable_dtype(dtype): | |||
# Converts integer <NA> to float NaN | |||
transformed[data.columns[i]] = data[data.columns[i]].astype(np.float32) |
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.
Is it correct to convert Int64 to float32?
is_bool_dtype, | ||
) | ||
|
||
nullable_alias = {"Int16", "Int32", "Int64"} |
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.
boolean
is nullable as well. Either it should be in this set or this set should be renamed.
cuDF uses nullable type by default, no special support is needed.
Close #6851 .