[SciPy-user] remove duplicate points...

Pierre GM pgmdevlist at gmail.com
Wed Apr 23 12:04:43 EDT 2008


Er, that may sound silly, but why not using numpy.unique ?
1. Transform your nx4 array into a n record array
2. use numpy.unique on the record array
3. revert to a nx4 array.

For example:
z=np.array([[1,1],[1,2],[1,2],[1,3]])
zr=z.view([('a',int),('b',int)]) 
zs = numpy.unique(zr).view((int,2))

Am I missing something ?




More information about the SciPy-User mailing list