numpy: handling float('NaN') different in XP vs. Linux
robert.kern at gmail.com
Mon Jun 16 21:57:06 CEST 2008
John [H2O] wrote:
> 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:
> for i in range(len(v)):
> newlist.append(-999.99) # or just nan possibly?
from numpy import nan
if x.lower() == 'nan':
newlist = [myfloat(x) for x in v]
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list