MCPcopy Index your code
hub / github.com/numpy/numpy / union1d

Function union1d

numpy/ma/extras.py:1463–1484  ·  view source on GitHub ↗

Union of two arrays. The output is always a masked array. See `numpy.union1d` for more details. See Also -------- numpy.union1d : Equivalent function for ndarrays. Examples -------- >>> import numpy as np >>> ar1 = np.ma.array([1, 2, 3, 4]) >>> ar2 = np.ma

(ar1, ar2)

Source from the content-addressed store, hash-verified

1461
1462
1463def union1d(ar1, ar2):
1464 """
1465 Union of two arrays.
1466
1467 The output is always a masked array. See `numpy.union1d` for more details.
1468
1469 See Also
1470 --------
1471 numpy.union1d : Equivalent function for ndarrays.
1472
1473 Examples
1474 --------
1475 >>> import numpy as np
1476 >>> ar1 = np.ma.array([1, 2, 3, 4])
1477 >>> ar2 = np.ma.array([3, 4, 5, 6])
1478 >>> np.ma.union1d(ar1, ar2)
1479 masked_array(data=[1, 2, 3, 4, 5, 6],
1480 mask=False,
1481 fill_value=999999)
1482
1483 """
1484 return unique(ma.concatenate((ar1, ar2), axis=None))
1485
1486
1487def setdiff1d(ar1, ar2, assume_unique=False):

Callers 1

test_union1dMethod · 0.90

Calls 1

uniqueFunction · 0.70

Tested by 1

test_union1dMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…