[Numpy-discussion] How do I test if an array contains NaN ?

Sebastian Haase seb.haase at gmx.net
Thu Jan 4 17:18:18 CST 2007


On 1/4/07, Keith Goodman <kwgoodman at gmail.com> wrote:
> On 1/4/07, Sebastian Haase <haase at msg.ucsf.edu> wrote:
> > How do I test if an array contains NaN ?
> > Or others like inf ...?
>
> isnan()
> ~isfinite()
> any()

Aah ! thanks,
you mean I have to create an intermediate array that tells me for
every element if is's a nan
and then check any( ... ) on this !?

That's OK for what I need -- seems excessive for large arrays though ....

Thanks again,
Sebastian


More information about the Numpy-discussion mailing list