[Numpy-discussion] unique 2d arrays

Peter Schmidtke pschmidtke@mmb.pcb.ub...
Tue Sep 21 10:23:41 CDT 2010


Hey Josef,

I didn't stumble upon these posts. Thanks for the hint...it doesn't look
very pythonic or matlab like still. This would be a nice thing to have a
unique function that is able to take an axis argument.

Cheers.

Peter

josef.pktd@gmail.com wrote:
> On Tue, Sep 21, 2010 at 2:55 AM, Peter Schmidtke
> <pschmidtke@mmb.pcb.ub.es> wrote:
>   
>> Dear all,
>>
>> I'd like to know if there is a pythonic / numpy way of retrieving unique
>> lines of a 2d numpy array.
>>
>> In a way I have this :
>>
>> [[409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [409 152]
>>  [426 193]
>>  [431 129]]
>>
>> And I'd like to get this :
>>
>> [[409 152]
>>  [426 193]
>>  [431 129]]
>>
>>
>> How can I do this without workarounds like string concatenation or such
>> things? Numpy.unique flattens the whole array so it's not really of use
>> here.
>>     
>
> One possibility see thread at
> http://mail.scipy.org/pipermail/numpy-discussion/2009-August/044664.html
>
> Josef
>
>
>
>   
>> Cheers.
>>
>> -- Peter Schmidtke
>>
>> PhD Student
>> Dept. Physical Chemistry
>> Faculty of Pharmacy
>> University of Barcelona
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>     
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>   


-- 

Peter Schmidtke
PhD Student
Dept. Physical Chemistry
Faculty of Pharmacy
University of Barcelona



More information about the NumPy-Discussion mailing list