[Numpy-discussion] in(np.nan) on python 2.6
Tue Nov 25 11:23:33 CST 2008
Sorry to bump my own post, and I was kinda threadjacking anyway:
Some functions of numy.ma (eg, ma.max, ma.min...) accept explicit
outputs that may not be MaskedArrays.
When such an explicit output is not a MaskedArray, a value that should
have been masked is transformed into np.nan.
That worked great in 2.5, with np.nan automatically transformed to 0
when the explicit output had a int dtype. With Python 2.6, a
ValueError is raised instead, as np.nan can no longer be casted to int.
What should be the recommended behavior in this case ? Raise a
ValueError or some other exception, to follow the new Python2.6
convention, or silently replace np.nan by some value acceptable by int
dtype (0, or something else) ?
Thanks for any suggestion,
More information about the Numpy-discussion