[Numpy-discussion] equivalent to isempty command in matlab (newbie question), (Robert Kern)

Francesc Altet faltet at carabos.com
Thu Dec 7 05:15:49 CST 2006


El dj 07 de 12 del 2006 a les 11:36 +0100, en/na Giorgio Luciano va
escriure:
> Does it exist a workaround for that to make numpy understand when an 
> array is empty ?
> Giorgio
> 

I guess there should be many. One possibility is to use .size:

In [9]:a=numpy.array([])
In [10]:a.size == False
Out[10]:True
In [11]:a=numpy.array([1])
In [12]:a.size == False
Out[12]:False

Cheers,

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth



More information about the Numpy-discussion mailing list