[SciPy-user] What about 'None'? Comment about nan...

Robert Kern robert.kern at gmail.com
Thu Nov 30 01:29:30 CST 2006


Martin Kuemmel wrote:
> Hi,
> 
> this question may (as well) be trivial for some of us, but bothers
> me for some time. It is:
> 
>  >>> gaga = numpy.array([1.0,2.0,None])
>  >>> gaga
> array([1.0, 2.0, None], dtype=object)
> 
> The type of the array is 'object'. Is there a way to have 'None'
> in a numerical array type? Any trick, idea or recipe?

Nope. Can't be done.

> About nan: It is great that 'numpy.NAN' exists, but the handbook
>             says nothing about it. Are there more glorious, but
>             hidden constants or functions or methods?

If they're actually "hidden", then they are hidden for a reason (i.e., they are
distinctly inglorious). However, there are probably still some more constants
functions, and methods undocumented in the _Guide to NumPy_. There is only a
finite amount of time available.

If you would like to contribute your own finite time, the Wiki on scipy.org has
several useful places where you can contribute such information. One such is the
Numpy Example List. Oh look! It has a section on nans:

http://www.scipy.org/Numpy_Example_List#head-9a99475ede19768c7dff190af504c9cf1275c2cc

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list