bug?

humufr at yahoo.fr humufr at yahoo.fr
Sun Oct 22 17:45:42 CDT 2006


Hello, 

the docstring for compress in numpy give this

help(numpy.compress)

compress(condition, m, axis=None, out=None)
    compress(condition, x, axis=None) = those elements of x corresponding
    to those elements of condition that are "true".  condition must be the
    same size as the given dimension of x.


So (but perhaps I can misundertand the help due to my english) I don't 
undersand the following error, for me a and c array does have the same 
dimension and size. So someone can explain me the result please?

Thanks,

N.

In [86]: a = numpy.arange(9)

In [87]: a = numpy.arange(9).reshape(3,3)

In [88]: c = numpy.ones(9).reshape(3,3)

In [89]: numpy.compress(c,a)
---------------------------------------------------------------------------
exceptions.ValueError                                Traceback (most recent 
call last)

/home/gruel/tmp/Astro/FATBOY/<ipython console>

/home/gruel/usr/lib/python2.4/site-packages/numpy/core/fromnumeric.py in 
compress(condition, m, axis, out)
    353     except AttributeError:
    354         return _wrapit(m, 'compress', condition, axis, out)
--> 355     return compress(condition, axis, out)
    356
    357 def clip(m, m_min, m_max):

ValueError: condition must be 1-d array

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list