[Numpy-discussion] histogram2d error with empty inputs

Benjamin Root ben.root at ou.edu
Mon Jun 27 15:38:59 EDT 2011


I found another empty input edge case.  Somewhat recently, we fixed an issue
with np.histogram() and empty inputs (so long as the bins are somehow
known).

>>> np.histogram([], bins=4)
(array([0, 0, 0, 0]), array([ 0.  ,  0.25,  0.5 ,  0.75,  1.  ]))

However, histogram2d needs the same treatment.

>>> np.histogram([], [], bins=4)
(array([ 0.,  0.]), array([ 0.  ,  0.25,  0.5 ,  0.75,  1.  ]), array([ 0.
,  0.25,  0.5 ,  0.75,  1.  ]))

The first element in the return tuple needs to be 4x4 (in this case).

Thanks,
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110627/374077dd/attachment.html>


More information about the NumPy-Discussion mailing list