[Numpy-discussion] Efficient removal of duplicates

Andrew Straw strawman@astraw....
Mon Dec 15 13:57:15 CST 2008

Hanno Klemm wrote:
> Hi,
> I the following problem: I have a relatively long array of points
> [(x0,y0), (x1,y1), ...]. Apparently, I have some duplicate entries, which
> prevents the Delaunay triangulation algorithm from completing its task.
> Question, is there an efficent way, of getting rid of the duplicate
> entries?
> All I can think of involves loops. 
> Thanks and regards,
> Hanno

One idea is to create a view of the original array with a shape of (N,)
and elements with a dtype that encompases both xn, yn. Then use
numpy.unique() to find the unique entries, and create a view of that
array with your original dtype.


More information about the Numpy-discussion mailing list