Skip to content

Commit 6cb7094

Browse files
authored
Merge pull request #2503 from neutrinoceros/numpy2_depr
MNT: replace `np.in1d` (deprecated) with `np.isin`
2 parents c0a8794 + 5b9472d commit 6cb7094

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

glue/core/joins.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get_mask_with_key_joins(data, key_joins, subset_state, view=None):
5656

5757
key_left = data.get_data(cid1[0], view=view)
5858
key_right = other.get_data(cid2[0], view=mask_right)
59-
mask = np.in1d(key_left.ravel(), key_right.ravel())
59+
mask = np.isin(key_left.ravel(), key_right.ravel())
6060

6161
return mask.reshape(key_left.shape)
6262

@@ -72,7 +72,7 @@ def get_mask_with_key_joins(data, key_joins, subset_state, view=None):
7272
key_left_all = concatenate_arrays(*key_left_all)
7373
key_right_all = concatenate_arrays(*key_right_all)
7474

75-
mask = np.in1d(key_left_all, key_right_all)
75+
mask = np.isin(key_left_all, key_right_all)
7676

7777
return mask.reshape(data.get_data(cid1_i, view=view).shape)
7878

@@ -82,7 +82,7 @@ def get_mask_with_key_joins(data, key_joins, subset_state, view=None):
8282
mask = np.zeros_like(key_left, dtype=bool)
8383
for cid2_i in cid2:
8484
key_right = other.get_data(cid2_i, view=mask_right).ravel()
85-
mask |= np.in1d(key_left, key_right)
85+
mask |= np.isin(key_left, key_right)
8686

8787
return mask.reshape(data.get_data(cid1[0], view=view).shape)
8888

@@ -92,7 +92,7 @@ def get_mask_with_key_joins(data, key_joins, subset_state, view=None):
9292
mask = np.zeros_like(data.get_data(cid1[0], view=view).ravel(), dtype=bool)
9393
for cid1_i in cid1:
9494
key_left = data.get_data(cid1_i, view=view).ravel()
95-
mask |= np.in1d(key_left, key_right)
95+
mask |= np.isin(key_left, key_right)
9696

9797
return mask.reshape(data.get_data(cid1[0], view=view).shape)
9898

glue/core/subset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ def to_mask(self, data, view=None):
14861486
vals = data[self._att, view]
14871487
if isinstance(vals, categorical_ndarray):
14881488
vals = vals.codes
1489-
result = np.in1d(vals.ravel(), self._categories)
1489+
result = np.isin(vals.ravel(), self._categories)
14901490
return result.reshape(vals.shape)
14911491

14921492
def copy(self):

0 commit comments

Comments
 (0)