Use Python set and then convert to numpy array?




Pablo Romero <romero619@hotmail.com>

18/03/2009 01:50 PM

To
<matplotlib-users@lists.sourceforge.net>
cc
Subject
[Matplotlib-users] quick numpy question






quick numpy-related question.

I want to use numpy.arange() to create multiple arrays, and then I want to join these arrays (or individual elements) to the final array without repeating existing elements (create a 'union' from 2 or more arrays or individual elements).
example:

lev=np.arange(0,20,2)
# lev=(0,2,4,6,8,...,20)

lev1=np.arange(0,18,3)
#lev1=(0,3,6,9,12,15,18)

#I want something like...

lev3=lev1+lev2

#WITHOUT repeating elements (i.e., only one '12' in resulting array), i.e., I want:
#lev3=(0,2,3,4,6,8,9,10,12,14,15,16,18,20)

#or, add just a unique element(s)

lev4=lev3+(50,60)

#so I would want lev4 to look like this:
#lev4=(0,2,3,4,6,8,9,10,12,14,15,16,18,20,50,60)


are these types of operations possible using numpy?
How can this be done?

Please help

Thanks,

P.Romero
_________________________________________________________________
Windows Live™ Contacts: Organize your contact list.
http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


UNITED GROUP
This email message is the property of United Group. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, you may not disclose, copy or distribute this email, nor take or omit to take any action in reliance on it. United Group accepts no liability for any damage caused by this email or any attachments due to viruses, interference, interception, corruption or unauthorised access.
If you have received this email in error, please notify United Group immediately by email to the sender's email address and delete this document.