[Numpy-discussion] Remove duplicate columns

T J tjhnson at gmail.com
Thu May 6 16:45:06 EDT 2010


On Thu, May 6, 2010 at 10:36 AM,  <josef.pktd at gmail.com> wrote:
>
> there is a thread last august on unique rows which might be useful,
> and a thread in Dec 2008 for sorting rows
>
> something like
>
> np.unique1d(c.view([('',c.dtype)]*c.shape[1])).view(c.dtype).reshape(-1,c.shape[1])
>
> maybe it's np.unique with numpy 1.4.
>

The thread is useful:

  http://www.mail-archive.com/numpy-discussion@scipy.org/msg19830.html

I'll have to see if it is quicker for me to just do:

>>> y = x.transpose().tolist()
>>> y.sort()
>>> x = np.array(y).transpose()



More information about the NumPy-Discussion mailing list