[Numpy-discussion] None as missing value
svetosch at gmx.net
Mon Jul 3 14:01:24 CDT 2006
Pierre GM schrieb:
>> I was also a bit surprised at the following behavior:
>>>> a = numpy.asarray([1,1])
> array([1, 1])
> array([0, 1])
> Seems to affect only the int_ arrays:
>>>> a = numpy.asarray([1,1], dtype=float_)
> array([1., 1.])
> array([ nan, 1. ])
Sure it works with floats. The question is, should there maybe be an
error if the type of the assigned value doesn't match the dtype of the
array, instead of silently doing something unexpected?
Consider the following (with still the same *integer* array a from my
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: an integer is required
This TypeError makes a lot of sense, but why does it only react to
strings, not to floats?
More information about the Numpy-discussion