I have an array where each element is the mean of a set of random numbers. I want to be able to remove duplicate values in this array. How would I go about doing this?
So far I have tried:
for i in range(len(array)):
for j in array:
if array[i] == j:
and then some operation to remove the element from the array. However, this will just remove every instance of every duplicated element.
You could simply use np.unique():
unique_values = np.unique(array)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With