[Numpy-discussion] Remove duplicate columns

josef.pktd at gmail.com josef.pktd at gmail.com
Thu May 6 17:42:12 EDT 2010


On Thu, May 6, 2010 at 4:45 PM, T J <tjhnson at gmail.com> wrote:
> 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()

for sure it's easier to read. the difference might be temporary array
creation compared to using numpy.sort on a view.

Josef

> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list