Skip to content
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

BUG: pd.merge fail with numpy.uintc on Windows #58713

Open
2 of 3 tasks
Noname37486 opened this issue May 14, 2024 · 2 comments · May be fixed by #58727
Open
2 of 3 tasks

BUG: pd.merge fail with numpy.uintc on Windows #58713

Noname37486 opened this issue May 14, 2024 · 2 comments · May be fixed by #58727
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Windows Windows OS

Comments

@Noname37486
Copy link

Noname37486 commented May 14, 2024

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

This bug is fixed by adding np.uintc to _factorizers in pd.merge. Could someone upload it fixed please?. For me the bug is fixed by adding in line 114 of core/reshape/merge.py file: np.uintc:libhastable.UInt32Factorizer.

import numpy as np
import pandas as pd

df1 = pd.DataFrame({'a':['foo','bar'],'b':np.array([1,2], dtype=np.uintc)})
df2 = pd.DataFrame({'a':['foo','baz'],'b':np.array([3,4], dtype=np.uintc)})
df3=df1.merge(df2, how = 'outer')
print(df3)

Issue Description

Traceback (most recent call last):
File "C:\Users\noname37486\PycharmProjects\pythonProject3\main.py", line 10, in
df3=df1.merge(df2, how = 'outer')
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\frame.py", line 10832, in merge
return merge(
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 184, in merge
return op.get_result(copy=copy)
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 886, in get_result
join_index, left_indexer, right_indexer = self._get_join_info()
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 1151, in _get_join_info
(left_indexer, right_indexer) = self._get_join_indexers()
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 1125, in _get_join_indexers
return get_join_indexers(
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 1740, in get_join_indexers
zipped = zip(*mapped)
File "C:\Users\v\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 1737, in
_factorize_keys(left_keys[n], right_keys[n], sort=sort)
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 2539, in _factorize_keys
klass, lk, rk = _convert_arrays_and_get_rizer_klass(lk, rk)
File "C:\Users\noname37486\PycharmProjects\pythonProject3\venv\lib\site-packages\pandas\core\reshape\merge.py", line 2616, in _convert_arrays_and_get_rizer_klass
klass = _factorizers[lk.dtype.type]
KeyError: <class 'numpy.uintc'>

Installed Versions

INSTALLED VERSIONS

commit : d9cdd2e
python : 3.9.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22631
machine : AMD64
processor : Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : es_ES.cp1252

pandas : 2.2.2
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.9.0.post0
setuptools : 57.0.0
pip : 21.1.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None

@Noname37486 Noname37486 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 14, 2024
@Tirthchoksi22
Copy link

Tirthchoksi22 commented May 15, 2024

@simonjayhawkins
Copy link
Member

xref #52451 (comment)

@simonjayhawkins simonjayhawkins added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Windows Windows OS and removed Needs Triage Issue that has not been reviewed by a pandas team member labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Windows Windows OS
Projects
None yet
3 participants