numpy: handling float('NaN') different in XP vs. Linux

John [H2O] washakie at gmail.com
Mon Jun 16 20:14:48 CEST 2008




Dan Bishop wrote:
> 
> 
> 
> Python just uses the atof() function from the underlying C library.
> Some of them handle NaN's, and some of them don't.
> 
> 

As a work around, how would I write this in list comprehension form:

         newlist=[]
         for i in range(len(v[1])):
            try:
               newlist.append(float(v[1][i]))
            except:
               newlist.append(-999.99) # or just nan possibly?




-- 
View this message in context: http://www.nabble.com/numpy%3A-handling-float%28%27NaN%27%29-different-in-XP-vs.-Linux-tp17835502p17870333.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list