Re: [Tutor] comparing two numpy arrays

2007-08-08 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote > No, a set is a sequence, you can convert it to a list directly: > b = list(a) But this is better than an LC obviously! :-) Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listin

Re: [Tutor] comparing two numpy arrays

2007-08-08 Thread Alan Gauld
"Andy Cheesman" <[EMAIL PROTECTED]> wrote > only way of interconversion a brute force method? > > i.e a = set([1, 2, 3]) > b = [] > for thing in a: > b.append(thing) Which looks a lot like a list comprehension: b = [member for member in Set([1,2,3])] HTH, -- Alan Gauld Author of the Learn to

Re: [Tutor] comparing two numpy arrays

2007-08-08 Thread Kent Johnson
Andy Cheesman wrote: > I've googled a bit for manipulation of > sets into other data structure(lists, arrays) and not seen much. Is the > only way of interconversion a brute force method? > > i.e a = set([1, 2, 3]) > b = [] > for thing in a: > b.append(thing) No, a set

Re: [Tutor] comparing two numpy arrays

2007-08-08 Thread Andy Cheesman
Thats a great solution, thanks! I've googled a bit for manipulation of sets into other data structure(lists, arrays) and not seen much. Is the only way of interconversion a brute force method? i.e a = set([1, 2, 3]) b = [] for thing in a: b.append(thing) Andy

Re: [Tutor] comparing two numpy arrays

2007-08-07 Thread Bob Gailer
Eric Brunson wrote: > Bob Gailer wrote: >> Andy Cheesman wrote: >> >>> Hi people, >>> >>> If I've two numpy arrays, is there a non-looping way of finding common >>> values. (the example below has identical shapes for the arrays but this >>> may not be the case in my scenario) >>> >>> e.g >>> a =

Re: [Tutor] comparing two numpy arrays

2007-08-07 Thread Eric Brunson
Bob Gailer wrote: > Andy Cheesman wrote: > >> Hi people, >> >> If I've two numpy arrays, is there a non-looping way of finding common >> values. (the example below has identical shapes for the arrays but this >> may not be the case in my scenario) >> >> e.g >> a = array([0, 1, 2, 3, 4, 5, 6, 7,

Re: [Tutor] comparing two numpy arrays

2007-08-07 Thread Bob Gailer
Andy Cheesman wrote: > Hi people, > > If I've two numpy arrays, is there a non-looping way of finding common > values. (the example below has identical shapes for the arrays but this > may not be the case in my scenario) > > e.g > a = array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) > b = array([ 5, 6, 7,

Re: [Tutor] comparing two numpy arrays

2007-08-07 Thread Mike Hansen
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Andy Cheesman > > Hi people, > > If I've two numpy arrays, is there a non-looping way of finding common > values. (the example below has identical shapes for the > arrays but this > may not be the case in my scenario) > > e.g >

[Tutor] comparing two numpy arrays

2007-08-07 Thread Andy Cheesman
Hi people, If I've two numpy arrays, is there a non-looping way of finding common values. (the example below has identical shapes for the arrays but this may not be the case in my scenario) e.g a = array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) b = array([ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) answer =