Re: [Numpy-discussion] np.unique for one bi-dimensional array

2012-07-24 Thread Val Kalatsky
There are various ways to repack the pair of arrays into one array. The most universal is probably to use structured array (can repack more than a pair): x = np.array(zip(a, b), dtype=[('a',int), ('b',int)]) After repacking you can use unique and other numpy methods: xu = np.unique(x) zip(xu['a'

Re: [Numpy-discussion] np.unique for one bi-dimensional array

2012-07-24 Thread eat
Hi, On Wed, Jul 25, 2012 at 1:09 AM, Giuseppe Amatulli < giuseppe.amatu...@gmail.com> wrote: > Hi, > > would like to identify unique pairs of numbers in two arrays o in one > bi-dimensional array, and count the observation > > a_clean=array([4,4,5,4,4,4]) > b_clean=array([3,5,4,4,3,4]) > > and ob

[Numpy-discussion] np.unique for one bi-dimensional array

2012-07-24 Thread Giuseppe Amatulli
Hi, would like to identify unique pairs of numbers in two arrays o in one bi-dimensional array, and count the observation a_clean=array([4,4,5,4,4,4]) b_clean=array([3,5,4,4,3,4]) and obtain (4,3,2) (4,5,1) (5,4,1) (4,4,2) I solved with tow loops but off course there will be a fast solution Any