[Numpy-discussion] What is the logical value of nan?

Pauli Virtanen pav at iki.fi
Tue Mar 10 17:09:45 EDT 2009


Tue, 10 Mar 2009 13:08:17 -0600, Charles R Harris wrote:
> It isn't 0 so it should be True. Any disagreement?

+1

Nonzero Python object, hence True. Moreover, it's also True in Python:

>>> import numpy as np
>>> type(np.nan)
<type 'float'>
>>> bool(np.nan)
True

IMHO, we should follow Python here, otherwise unnecessary confusion may 
arise.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list