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

Charles R Harris charlesr.harris@gmail....
Tue Aug 12 19:31:48 CDT 2008


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

>
>
> On Tue, Aug 12, 2008 at 5:13 PM, Andrew Dalke <dalke@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://projects.scipy.org/pipermail/numpy-discussion/attachments/20080812/47ceab6b/attachment.html 


More information about the Numpy-discussion mailing list