[Numpy-discussion] [ANN] Nanny, faster NaN functions
Nathaniel Smith
njs@pobox....
Fri Nov 19 21:57:04 CST 2010
On Fri, Nov 19, 2010 at 7:51 PM, <josef.pktd@gmail.com> wrote:
> On Fri, Nov 19, 2010 at 10:42 PM, Keith Goodman <kwgoodman@gmail.com> wrote:
>> It basically loops through the data and does:
>>
>> allnan = 1
>> ai = ai[i,k]
>> if ai > amax:
>> amax = ai
>> allnan = 0
>
> does this give you the correct answer?
>
>>>> 1>np.nan
> False
Yes -- notice he does the comparison the other way, and
>>> 1 < np.nan
False
(All comparisons involving NaN return false, including, famously, NaN
== NaN, which is why we need np.isnan.)
-- Nathaniel
More information about the NumPy-Discussion
mailing list