Skip to content

BUG: isin() give incorrect results for uint64 columns #46485

Closed
@AlexSingle

Description

@AlexSingle

Pandas version checks

  • I have checked that this issue has not already been reported.

  • 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

import pandas as pd
import numpy as np
test_df = pd.DataFrame([{'a': 1378774140726870442}], dtype=np.uint64)
test_df[test_df['a'].isin([1378774140726870528])]
                     a
0  1378774140726870442
test_df[test_df['a'].isin([1378774140726870522])]
                     a
0  1378774140726870442

Issue Description

I have column in uin64 and want to check if values in some list. but isin returning incorrect results. I suspect where some Implicit type conversion, cause I was't able to reproduce for other types

Expected Behavior

For examples I expected empty DataFrame in both cases

Installed Versions

INSTALLED VERSIONS

commit : 06d2301
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.100-23
Version : #1 SMP Fri Jan 31 16:16:00 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.4.1
numpy : 1.21.2
pytz : 2020.5
dateutil : 2.8.2
pip : 20.0.2
setuptools : 58.2.0
Cython : 0.29.24
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : None
pymysql : None
psycopg2 : 2.9.1
jinja2 : 3.0.2
IPython : 7.28.0
pandas_datareader: None
bs4 : 4.10.0
bottleneck : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.4.3
numba : None
numexpr : None
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.7.1
sqlalchemy : 1.4.25
tables : None
tabulate : 0.8.9
xarray : None
xlrd : None
xlwt : None
zstandard : None

Metadata

Metadata

Assignees

Labels

AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffBugRegressionFunctionality that used to work in a prior pandas version

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

      翻译: