-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: numpy.result_type on non-array objects that have a dtype attribute should always return dtype object #26612
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
Comments
Hmmm, trick apparently |
Not sure about the exact meaning of your question 😅, but indeed it looks like Maybe this is a not such a great idea in scikit-learn to have objects with |
I was wondering if there is a regression. I don't think so. One longer term solution might be to add |
Indeed, I don't think it is a regression either |
Describe the issue:
numpy.result.dtype
on non-array objects that have a.dtype
attribute will unexpectedly use the.dtype
attribute instead of returning dtype object.Creating an array with the same objects will as expected return an array of dtype object, but sometimes it is convenient to know the dtype without creating the array.
Reproduce the code example:
Error message:
Python and NumPy Versions:
Tried with 1.26.3 and development Numpy wheel
Runtime Environment:
No response
Context for the issue:
This was noticed in scikit-learn where some estimators like
OrdinalEncoder
have adtype
parameter and hence a.dtype
atribute: scikit-learn/scikit-learn#29157 (comment)The text was updated successfully, but these errors were encountered: