[Numpy-discussion] min() of array containing NaN
Kevin Jacobs <jacobs@bioinformed.com>
bioinformed@gmail....
Tue Aug 12 07:42:54 CDT 2008
On Tue, Aug 12, 2008 at 1:46 AM, Andrew Dalke <dalke@dalkescientific.com>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.
-Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080812/7f08ed7f/attachment.html
More information about the Numpy-discussion
mailing list