-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: use more explicit to_numpy(object) instead of astype(object) in EA implementation #45521
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
REF: use more explicit to_numpy(object) instead of astype(object) in EA implementation #45521
Conversation
…EA implementation
Can't speak to the general case, but DTA is more performant in astype
|
Good catch. That seems to be because in datetimelike pandas/pandas/core/arrays/datetimelike.py Lines 313 to 316 in fefccfe
We can probably call astype there (or do the same than astype does). Astype special cases object dtype for datetime64 to directly call pandas/pandas/core/arrays/datetimelike.py Lines 410 to 422 in fefccfe
(which is what |
xref #44484 for dispatch logic |
Yes, although the behaviour differences I note in that issue are for other dtypes, not object dtype (for object, it's only a matter of performance, as far as I see) |
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
Somewhat related to #24877 / #43699, but regardless of whether we want to stop
astype
returning numpy arrays or not, I think when we know we want to get an object-dtype numpy array as result, usingto_numpy(object)
is more explicit about this when reading the code.