[Numpy-discussion] Any and all NaNs
Fri May 23 14:00:01 CDT 2008
On Fri, May 23, 2008 at 11:44 AM, Robert Kern <email@example.com> wrote:
> On Fri, May 23, 2008 at 12:22 PM, Keith Goodman <firstname.lastname@example.org> wrote:
>> But the first example
>>>> x = mp.matrix([[mp.nan]])
>> matrix([[ NaN]])
>> is still surprising.
> On non-boolean arrays, .all() and .any() check each element to see if
> it is not equal to 0. NaN != 0. Returning False would be just as
> wrong. If there were a Maybe in addition to True and False, then
> perhaps that would be worth changing, but I don't see a reason to
> change the rule as it is.
That makes sense. Hopefully it will find its way into the doc string.
If I want NaNs to be False I can always do
(x == x).all()
More information about the Numpy-discussion