Is there an easy possibility to delete similar values in an array (with condition) without using a for loop? For example lets say I have an array
np.array([1.2, 3.4, 3.5, 8.9, 10.9])
In this case, i would set the condition for example difference < 0.3 and get as an output
np.array([1.2, 3.4, 8.9, 10.9])
I haven't seen anything on the internet similar to this question. Of course there is the function .unique() but that is only for exactly the same values.
3.4, 3.5, 3.6? And what is with the case where you have a row of similar values, for example:[3.4, 3.5, 3.6, 3.7, 3.8, 3.9]? Depending on this you need to define your own function.[1.2, 1.5, 1.7]? Here you can either keep[1.5]or keep[1.2, 1.7]3.4, 3.6, 3.8? Are the values always sorted – which values to keep out of3.4, 1.2, 3.5?