[Numpy-discussion] Efficient removal of duplicates
Mon Dec 15 13:57:15 CST 2008
Hanno Klemm wrote:
> 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
> All I can think of involves loops.
> Thanks and regards,
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