numpy.union1d() function in Python Last Updated : 12 Jun, 2020 Comments Improve Suggest changes Like Article Like Report numpy.union1d() function find the union of two arrays and return the unique, sorted array of values that are in either of the two input arrays. Syntax : numpy.union1d(arr1, arr2) Parameters : arr1, arr2 : [array_like] Input arrays. Return : [ndarray] Unique, sorted union of the input arrays. Code #1 : Python3 # Python program explaining # numpy.union1d() function # importing numpy as geek import numpy as geek arr1 = [-1, 0, 1] arr2 = [-2, 0, 2] gfg = geek.union1d(arr1, arr2) print (gfg) Output : [-2 -1 0 1 2] Code #2 : Python3 # Python program explaining # numpy.union1d() function # importing numpy as geek import numpy as geek arr1 = [-3, -2, -1, 0, 1, 2, 3] arr2 = [-5, -4, -3, 0, 3, 4, 5] gfg = geek.union1d(arr1, arr2) print (gfg) Output : [-5 -4 -3 -2 -1 0 1 2 3 4 5] Comment More infoAdvertise with us Next Article numpy.union1d() function in Python S sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy Python numpy-arrayManipulation python Practice Tags : Machine Learningpython Similar Reads Union() function in Python Union() method in Python is an inbuilt function provided by the set data type. It is used to combine multiple sets into a single set, containing all unique elements from the given sets. It ensures that no duplicate values exist in the final set.Python Set UnionThe symbol for denoting union of sets i 3 min read numpy.setxor1d() function in Python numpy.setxor1d() function find the set exclusive-or of two arrays and return the sorted, unique values that are in only one (not both) of the input arrays. Syntax : numpy.setxor1d(arr1, arr2, assume_unique = False) Parameters : arr1, arr2 : [array_like] Input arrays. assume_unique : [bool] If True, 1 min read numpy.in1d() function in Python numpy.in1d() function test whether each element of a 1-D array is also present in a second array and return a boolean array the same length as arr1 that is True where an element of arr1 is in arr2 and False otherwise. Syntax : numpy.in1d(arr1, arr2, assume_unique = False, invert = False) Parameters 2 min read numpy.char.add() function in Python The add() method of the char class in the NumPy module is used for element-wise string concatenation for two arrays of str or unicode. numpy.char.add()Syntax : numpy.char.add(x1, x2)Parameters : x1 : first array to be concatenated (concatenated at the beginning)x2 : second array to be concatenated ( 1 min read numpy.ma.clump_unmasked() function | Python numpy.ma.clump_unmasked() function returns list of slices corresponding to the unmasked clumps of a 1-D array. Syntax : numpy.ma.clump_unmasked(arr) Parameters : arr : [ndarray] A one-dimensional masked array. Return : [list of slice] The list of slices, one for each continuous region of unmasked el 1 min read Like