Say I have this type of array
y
array([299839, 667136, 665420, 665418, 665421, 667135, 299799, 665419, 667137, 299800])
as the result of a "top 10" argpartition:
y = np.argpartiton(-x, np.arange(10))[:10]
Now, I want to remove the elements that are sequential, only keeping the first (maximum) element in the series such that:
y_new
array([299839, 667136, 665420, 299799])
But while that seems like it should be simple I'm not seeing an efficient way to do it (or even a good way to start). Assume the real-world application will do the top 1000 or so and need to do it many times.