Open qltwis opened 3 weeks ago
Thanks for the report. Note all numbers here are within int64 limits, and NumPy creates the array here as int64. Also you get the expected result by specifying dtype="uint64"
in the NumPy array construction. My guess is pandas is converting to floats to do the comparison.
When given an array of int64 to test against, we need to handle the difference in dtypes (uint64 vs int64) and the fact that int64 could hold negatives. Perhaps we could strip out the negative values, then convert everything to uint64? I worry this would become a complex operation.
Further investigations and suggestions are welcome.
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[ ] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
The isin check returns
True
, although clearly 635554097106142143 ≠ 635554097106142079Presumably during the check the values are converted to a dtype with smaller precision.
Expected Behavior
Not using the
UInt64
dtype as well as not checking against a numpy array produce the expected resultI.e. both
and
Evaluate to
False
Installed Versions