From: Pablo R. <rom...@ho...> - 2009-03-18 02:50:51
|
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 |