[Numpy-discussion] min() of array containing NaN
Kevin Jacobs <email@example.com>
Tue Aug 12 07:42:54 CDT 2008
On Tue, Aug 12, 2008 at 1:46 AM, Andrew Dalke <firstname.lastname@example.org>wrote:
> Here's the implementation, from lib/function_base.py
> def nanmin(a, axis=None):
> """Find the minimium over the given axis, ignoring NaNs.
> y = array(a,subok=True)
> if not issubclass(y.dtype.type, _nx.integer):
> y[isnan(a)] = _nx.inf
> return y.min(axis)
No wonder nanmin is slow. A C implementation would run at virtually the
same speed as min. If there is interest, I'll be happy to code C versions.
A better solution would be to just support NaNs and Inf in the generic code.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion