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]])
You are expected to comply with University policies and guidelines namely, Appropriate Use of Information Resources Policy, IT Usage Policy and Social Media Policy. Users will be personally liable for any infringement of Copyright and Licensing laws. Unless otherwise stated, all guide content is licensed by CC BY-NC 4.0.