3 Nov 15:40 2015

### histogram gives meaningless results with non-finite range

Luke Zoltan Kelley <lzkelley <at> gmail.com>

2015-11-03 14:40:31 GMT

2015-11-03 14:40:31 GMT

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

_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion <at> scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion