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

Pauli Virtanen pav@iki...
Tue Mar 10 16:09:45 CDT 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