[Numpy-discussion] Medians that ignore values

Jake Harris jah.mailinglist@gmail....
Sat Sep 20 13:02:13 CDT 2008

(sorry for starting a new thread...I wasn't subscribed yet)

Stéfan van der Walt wrote the following on 09/19/2008 02:10 AM:
> So am I.  In all my use cases, NaNs indicate trouble.

I can provide a use case where NaNs do not indicate trouble.  In fact, they
need to be treated as 0.  For example,

As x->0 in y(x) = x log x, it is traditional (eg in information theory) to
take y(0) = 0.  So if one is multiplying arrays and 0 * -inf  is
encountered, the desirable behavior is that we get 0.   Because you're
always working with probabilities, there is almost always no
ambiguity...whenever NaN is encounter, 0 is what is desired.

Perhaps numpy can have some method by which a user can specify how NaNis
treated (in addition to ignore, raise, etc). Good idea? Bad idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080920/24bdf467/attachment.html 

More information about the Numpy-discussion mailing list