array subset could be improved? -repost ;)

Fernando Perez fperez.net at gmail.com
Fri Oct 14 17:40:09 EDT 2005


Jim O'D wrote:

> Hi all
> 
> I have an array a=array([2,3,-1]).
> 
> I want to extract an array with all the elements of a that are less than 0.

Numeric is currently changing into the new scipy core.  If you are willing to
play with beta code, get it here:

http://numeric.scipy.org

if not, wait a little for an official release.

With the new numeric, you'll be able to do:

negatives = a[a<0]

Cheers,

f




More information about the Python-list mailing list