-
-
Couldn't load subscription status.
- Fork 19.2k
BUG: isin casting to float64 for unsigned int and list #46693
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
Conversation
|
looks fine. cc @jbrockmendel if any comments. |
| if not isinstance(values, (ABCIndex, ABCSeries, ABCExtensionArray, np.ndarray)): | ||
| values = _ensure_arraylike(list(values)) | ||
| if not is_signed_integer_dtype(comps): | ||
| # GH#46485 Use object to avoid upcast to float64 later |
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.
IIUC the problem is that this comes back with int64, then np.find_common_type for int64+uint64 is float64, which is lossy for big integers.
we face a similar problem elsewhere, and ideally id like to re-use some of the logic we use for those. the place that comes to mind is in Index._find_common_type_compat.
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.
So we should move the logic from _find_common_type_compat into a helper function we can call in both places?
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.
if it can be done gracefully thatd be nice. otherwise i guess a TODO to look into sharing sooner or later
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.
Sharing this is not straightforward right now, so would add a todo and try to refactor later
|
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 @phofl |
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.The argument is cast to int64 which leads to an upcast later on -> to avoid this we can either use object-dtype for int or implement some casting logic which casts values to unsigned if possible