-
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
[FEA] A cudf.dtype
function similar to np.dtype(...)
#8915
Comments
(Copying this here so I don't forget from our slack discussion) Should we also make it so that |
I'm supportive of creating this feature, but I think it requires some care to get it just right. Some considerations:
Yes, I think we'd want to do that for consistency. However, in line with my previous points I'm guessing we'll only want that to be true in user-facing functions, not in internal utilities. |
Closes #8915 Authors: - Ashwin Srinath (https://github.com/shwina) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) - GALI PREM SAGAR (https://github.com/galipremsagar) - Benjamin Zaitlen (https://github.com/quasiben) URL: #8949
It would be useful to have a
cudf.dtype(...)
function that takes an arbitrary dtype-like object and coerces it to a dtype that we can handle. Specifcally, it should be a superset ofnp.dtype()
, but also handle Pandas extension types, as well as our own dtypes.Some examples:
Passing a NumPy-like dtype yields a
np.dtype()
instance:Passing a Pandas extension type yields a corresponding NumPy type (since we use NumPy dtypes for our own "nullable" types):
Passing a string alias yields the appropriate type:
Passing Python builtin types works (just like
np.dtype
)Passing a cuDF type works:
Special case: float16 is coerced to float32 since we don't have a float16 type:
Special case: unicode types are coerced to np.dtype("object")
Note: we could potentially extend this to handle Arrow types too, but let's punt on that for now.
The text was updated successfully, but these errors were encountered: