How can I use numpy unique without sorting the result but just in the order they appear in the sequence? Something like this?
a = [4,2,1,3,1,2,3,4]
np.unique(a) = [4,2,1,3]
rather than
np.unique(a) = [1,2,3,4]
Use naive solution should be fine to write a simple function. But as I need to do this multiple times, are there any fast and neat way to do this?
You can do this with the
return_indexparameter: