On Fri, Nov 19, 2010 at 7:51 PM,
does this give you the correct answer?
1>np.nan False
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]) 1.0 np.nanmax([np.nan, 1]) 1.0 np.nanmax([np.nan, 1, np.nan]) 1.0
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:
np.nanmax([]) <snip> ValueError: zero-size array to ufunc.reduce without identity
Nanny does this:
ny.nanmax([]) nan
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.