np.unique
lets you find out the unique elements of an array.
np.sort
enables you to sort the elements in your array.
It can be used as a function of NumPy or as a method which will both create the same results. Below are examples of both methods.
When used as a function, the original array does not change. When used as a method, the original array also changes.
You can also sort the elements in rows or columns of a matrix by specifying the axis.
1. Find the unique elements in this array:
myArray_1 = np.array([[2,2,3,4],[3,2,3,4]])
2. Sort the elements in this array by its rows:
myArray_2 = np.array([[2,3,1,4],[7,5,6,8]])
1. Find the unique elements in this array:
myArray_1 = np.array([[2,2,3,4],[3,2,3,4]])
2. Sort the elements in this array by its rows:
myArray_2 = np.array([[2,3,1,4],[7,5,6,8]])