numpy unique strange behaviour
Question: according to the official numpy.unique documentation
(<http://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html>)
return_index=True should allow me to recover the first occurrences of elements
in an array. However, this does not work for this simple example:

    
    
    import numpy as np
    a = np.array([10,20,30,40,50,60,70,80,3,2,4,3,2,5,2,1,999,1000])
    a = np.append(a,np.repeat(999,10000))
    u, indices = np.unique(a, return_index=True)
    print indices[13], u[13] #according to unique documentation indices[13] should be 16 (i.e. first occurrence of 999 = u[13]), but it is not
    

This results in:

    
    
    [mvogelsberger@itc021 ~]$ python test.py 
    6685 999
    

Clearly, 6685 is not the index of first occurrence of 999 in the array a. Can
someone clarify? I probably misunderstand the documentation...

Thanks! Mark


Answer: As you've guessed in the comments, this behaviour is indeed [a bug that was
fixed in Numpy
v1.7](https://github.com/numpy/numpy/commit/dbf235169ed3386b359caaa9217f5280bf1d6749)

