[Numpy-discussion] detecting a nan with all() or any()

Vasileios Gkinis v.gkinis at gfy.ku.dk
Tue Oct 21 11:30:23 EDT 2008


Hi,

I would like to detect if my array for example a = array((1,2,3,nan)) 
contains any nans
So when i use:
In [31]: all(a!=nan)
I get
Out[31]: True
And when i use:
In [35]: any(a==nan)
I get
Out[35]: False
Which looks rather wrong to me...or i am simply missing something
Can somebody comment on that...?

Regards
Vasili


-- 

------------------------------------------------------------

Vasileios Gkinis, PhD Student

Centre for Ice and Climate

Niels Bohr Institute

Juliane Maries Vej 30, room 321

DK-2100 Copenhagen

Denmark

Office: +45 35325913

v.gkinis at gfy.ku.dk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20081021/fea172b1/attachment.html>


More information about the NumPy-Discussion mailing list