[Numpy-discussion] bug in numpy.histogram?
John Hunter
jdh2358 at gmail.com
Wed Feb 20 16:49:37 EST 2008
We recently deprecated matplotlib.mlab.hist, and I am now hitting a
bug in numpy's historgram, which appears to be caused by the use of
"any" that does not exist in the namespace. Small patch attached.
The example below exposes the bug:
Python 2.4.2 (#1, Feb 23 2006, 12:48:31)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.3.svn.r2876 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import numpy as np
In [2]: np.__file__
Out[2]: '/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/__init__.pyc'
In [3]: np.__version__
Out[3]: '1.0.5.dev4814'
In [4]: x = np.random.randn(100)
In [5]: bins = np.linspace(x.min(), x.max(), 40)
In [6]: y = np.histogram(x, bins=bins)
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in ?
File "/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/function_base.py",
line 155, in histogram
if(any(bins[1:]-bins[:-1] < 0)):
NameError: global name 'any' is not defined
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hist_any.diff
Type: text/x-patch
Size: 533 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080220/29edaca6/attachment.bin>
More information about the NumPy-Discussion
mailing list