[Numpy-discussion] min() of array containing NaN

Charles R Harris charlesr.harris at gmail.com
Tue Aug 12 20:31:48 EDT 2008


On Tue, Aug 12, 2008 at 6:28 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:

>
>
> On Tue, Aug 12, 2008 at 5:13 PM, Andrew Dalke <dalke at dalkescientific.com>wrote:
>
>> On Aug 12, 2008, at 9:54 AM, Anne Archibald wrote:
>> > Er, is this actually a bug? I would instead consider the fact that
>> > np.min([]) raises an exception a bug of sorts - the identity of min is
>> > inf.
>>
> <snip>
>
>
>>
>> Personally, I expect that if my array 'x' has a NaN then
>> min(x) must be a NaN.
>>
>
> I suppose you could use
>
> min(a,b) = (abs(a - b) + a + b)/2
>
> which would have that effect.
>

Hmm, that is for the max, min would be

(a + b - |a - b|)/2

>
> Chuck
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080812/47ceab6b/attachment.html>


More information about the NumPy-Discussion mailing list