8000 MAINT: use np.isin instead of deprecated np.in1d · larray-project/larray@1c8aab4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c8aab4

Browse files
committed
MAINT: use np.isin instead of deprecated np.in1d
required for Numpy 2.0 compatibility (issue #1100)
1 parent 368db8a commit 1c8aab4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

larray/util/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def array_lookup(array, mapping):
303303
raise KeyError('key has not the same dtype than axis')
304304
# TODO: it is very important to fail quickly, so guess_axis should try this in chunks
305305
# (first test first element of key, if several axes match, try [1:11] elements, [12:112], [113:1113], ...
306-
if not np.all(np.in1d(array, sorted_keys)):
306+
if not np.all(np.isin(array, sorted_keys)):
307307
raise KeyError('all keys not in array')
308308

309309
sorted_values = np.array(sorted_values)
@@ -327,7 +327,7 @@ def array_lookup2(array, sorted_keys, sorted_values):
327327
raise KeyError('key has not the same dtype than axis')
328328
# TODO: it is very important to fail quickly, so guess_axis should try this in chunks
329329
# (first test first element of key, if several axes match, try [1:11] elements, [12:112], [113:1113], ...
330-
if not np.all(np.in1d(array, sorted_keys)):
330+
if not np.all(np.isin(array, sorted_keys)):
331331
raise KeyError('all keys not in array')
332332

333333
indices = np.searchsorted(sorted_keys, array)

0 commit comments

Comments
 (0)
0