-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
BUG: numpy.isin does not function correctly with two arrays with different integer type #22877
Copy link
Copy link
Closed
Labels
Milestone
Description
Describe the issue:
The function numpy.isin sometimes returns the wrong answer, if the integer type of the two arrays (to be compared) are not the same.
The example below shows a int8 array with one zero and a int64 array with two values. It should return one True. However, it returns False.
Reproduce the code example:
>>> import numpy as np
>>> np.isin(np.zeros(1, dtype=np.int8), np.array([-128, 0], dtype=np.int64), kind='table')
array([False])Error message:
No response
Runtime information:
Numpy version
>>> print(numpy.__version__)
1.24.0
Sys version
>>> print(sys.version)
3.11.1 (main, Dec 7 2022, 01:11:34) [GCC 11.3.0]
Numpy runtime
[{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': 'PATH_DELETED_DUE_TO_PRIVACY/.venv/lib/python3.11/site-packages/numpy.libs/libopenblas64_p-r0-15028c96.3.21.so',
'internal_api': 'openblas',
'num_threads': 20,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.21'}]
Context for the issue:
The problem seems to only occur in version 1.24.
Reactions are currently unavailable