On Mon, 9 Feb 2009 09:45:02 +0100 Francesc Alted <fal...@pytables.org> wrote: > A Monday 09 February 2009, Nils Wagner escrigué: >> Hi all, >> >> I have two integer arrays of different shape, e.g. >> >> >>> a >> >> array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) >> >> >>> b >> >> array([ 3, 4, 5, 6, 7, 8, 9, 10]) >> >> How can I extract the values that belong to the array a >> exclusively i.e. array([1,2]) ? > > One possible, fast solution is using Python sets: > > In [45]: np.array(list(set(a) ^ set(b))) > Out[45]: array([1, 2]) > > Although this is suboptimal for very large arrays as it >needs temporary > space. > > Cheers, > > -- >Francesc Alted Thank you very much for your prompt response.
Nils _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion