[Numpy-discussion] [ANN] Nanny, faster NaN functions
Fri Nov 19 21:59:55 CST 2010
On Fri, Nov 19, 2010 at 7:51 PM, <email@example.com> wrote:
> does this give you the correct answer?
> What's the starting value for amax? -inf?
Because "1 > np.nan" is False, the current running max does not get
updated, which is what we want.
>> import nanny as ny
>> np.nanmax([1, np.nan])
>> np.nanmax([np.nan, 1])
>> np.nanmax([np.nan, 1, np.nan])
Starting value is -np.inf for floats and stuff like this for ints:
cdef np.int32_t MININT32 = np.iinfo(np.int32).min
cdef np.int64_t MININT64 = np.iinfo(np.int64).min
Numpy does this:
ValueError: zero-size array to ufunc.reduce without identity
Nanny does this:
So I haven't taken care of that corner case yet. I'll commit nanmax to
github in case anyone wants to give it a try.
More information about the NumPy-Discussion