[Numpy-discussion] different behaviour in asfarray(None)

Stéfan van der Walt stefan@sun.ac...
Tue Apr 22 10:29:21 CDT 2008


2008/4/22 lorenzo bolla <lbolla@gmail.com>:
> I noticed a change in the behaviour of numpy.asfarray between numpy version
> 1.0.5 and 1.1.0:
>
> 1.0.5
> ====
>
> In [3]: numpy.asfarray(None)
> Out[3]: array(nan)
> In [4]: numpy.__version__
> Out[4]: '1.0.5.dev4455'
>
> 1.1.0
> ====
>
> In [16]: numpy.asfarray(None)
> ---------------------------------------------------------------------------
> <type 'exceptions.TypeError'>: float() argument must be a string or a number
>
> Is this intended? why?

Yes, 'asfarray' is equivalent to

array(input).astype(dtype)

I think it would be wrong to assume that None means NaN.

Cheers
Stéfan


More information about the Numpy-discussion mailing list