np array value count

unique_elements, counts_elements = np.unique(a, return_counts=True)

Here is what the above code is Doing:
1. We use the np.unique function to get the unique values in the array.
2. We use the return_counts parameter to get the counts of each unique value.
3. We store the unique values and their counts in the unique_elements and counts_elements variables, respectively.