From: <hu...@ya...> - 2006-10-22 22:45:51
|
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 |