[SciPy-user] Delete equal elements from array

Sahar Vilan sahar@cmt.co...
Tue Feb 17 02:32:22 CST 2009


Thanks

-----Original Message-----
From: scipy-user-bounces@scipy.org
[mailto:scipy-user-bounces@scipy.org]On Behalf Of Francesc Alted
Sent: Tue, February 17, 2009 9:58 AM
To: SciPy Users List
Subject: Re: [SciPy-user] Delete equal elements from array


A Tuesday 17 February 2009, Sahar Vilan escrigué:
> Hi,
>
> I have to exclude equal elements from an array.
> x1 = np.array([1, 4, 5, 5])
>
> Is there any function to get from x1 an array with one element of
> each kind ( [1, 4, 5, 5] -> [1, 4, 5])?

Yes.  Try np.unique (or np.unique1d, depending on your needs):

In [2]: x1 = np.array([1, 4, 5, 5])

In [3]: np.unique(x1)
Out[3]: array([1, 4, 5])

Cheers,

-- 
Francesc Alted
_______________________________________________
SciPy-user mailing list
SciPy-user@scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user


 
 
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************


No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.237 / Virus Database: 270.10.25/1956 - Release Date: 02/16/09 18:31:00





*******************************************************************************************************
This e-mail message may contain confidential,and  privileged information or data that constitute proprietary information of CMT Medical Ltd. Any review or distribution by others is strictly prohibited. If you are not the intended recipient you are hereby notified that any use of this information or data by any other person is absolutely prohibited. If you are not the intended recipient, please delete all copies. Thank You. http://www.cmt.co.il
********************************************************************************************************





 
 
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************





More information about the SciPy-user mailing list