On Jul 19, 8:35 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Alex Mont" <[EMAIL PROTECTED]> wrote in message
> I have a 2-dimensional Numeric array with the shape (2,N) and I want to
> remove all duplicate rows from the array. For example if I start out
> with:
> [[1,2],
> [1,3],
> [1,2],
> [2,3]]
>
> I want to end up with
> [[1,2],
> [1,3],
> [2,3]].

Converting to a set is the best way to go.  You can convert [1, 2] to
something like "001002" and use that if you first locate, or already
know the largest number.  The brute force way is to loop through the
list and compare this sub-list with list[N+1], then list[N+2], to the
end of the list.  If not found then append to a second list.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to