numpy.where behavior

vallis.35530053 at bloglines.com vallis.35530053 at bloglines.com
Mon Nov 13 19:32:24 CST 2006


Using numpy 1.0, why does



>>> a = numpy.array([0.0,1.0,2.0],'d')

>>> numpy.where(a
== 0.0,1,1/a)



give the correct result, but with the warning "Warning: divide
by zero encountered in divide"?



? I thought that the point of where was
that the second expression is never used for the elements where the condition
evaluates true. 



If this is the desired behavior, is there a way to suppress
the warning?



Thanks!



Michele

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list