[Numpy-tickets] [NumPy] #656: numpy.histogram fails if bins is a sequence
NumPy
numpy-tickets@scipy....
Mon Feb 11 07:40:54 CST 2008
#656: numpy.histogram fails if bins is a sequence
---------------------------+------------------------------------------------
Reporter: jochen.eppler | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 1.0.5
Component: numpy.lib | Version: devel
Severity: major | Keywords:
---------------------------+------------------------------------------------
With numpy 1.04, the following code
{{{
import numpy
xs = numpy.arange(0.0, 20.0, 0.1)
hist = numpy.histogram(xs, bins=numpy.linspace(0.0, 20.0, 4.0))
}}}
produces an exception.
{{{
---------------------------------------------------------------------------
exceptions.NameError Traceback (most
recent call last)
/usr/lib/python2.4/site-packages/numpy/lib/function_base.py in
histogram(a, bins, range, normed)
152 bins = linspace(mn, mx, bins, endpoint=False)
153 else:
--> 154 if(any(bins[1:]-bins[:-1] < 0)):
155 raise AttributeError, 'bins must increase
monotonically.'
156
NameError: global name 'any' is not defined
}}}
With 1.0.3 the function works nicely.
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/656>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list