[Numpy-discussion] histogram gives meaningless results with non-finite range
Luke Zoltan Kelley
lzkelley at gmail.com
Tue Nov 3 09:40:31 EST 2015
This came up in [a matplotlib issue](https://github.com/matplotlib/matplotlib/issues/5221):
>>> np.histogram(np.arange(10), range=(0.0, np.inf))
(array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
array([ nan, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf]))
>>> np.histogram(np.arange(10), range=(0.0, np.nan))
(array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
array([ nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan]))
Clearly the behavior is undefined for those arguments, but perhaps there should be an assertion that the given range must be finite? Happy to make a PR for this.
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151103/32966739/attachment.html>
More information about the NumPy-Discussion
mailing list