[Numpy-discussion] Histgrom density estimation (density kwarg) with out of range values

Sebastian Berg sebastian at sipsolutions.net
Fri May 31 16:45:46 EDT 2019

Hi all,

unfortunately it was noticed in Issue 13604 [0] that when histogram is
given used with a specified range and the `density=True` keyword
argument out of bound values are simply discarded [1].

Discarding out of bound values makes sense when the density/normed
option is not used, since in that case event counts are reported.
However, when out of bound values exist, the probability density should
arguably not sum up to 1 anymore.

We seem to have three ways possible to continue here:

1. Call it an outright bug and fix it.
2. Add a FutureWarning, and change it later (unfortunately noisy)
3. Add a new kwarg to control what happens and a FutureWarning which
   can be silenced using the new kwarg.

(No change will ever happen if `range` or manual bin edges were not

If all agree that there is no reasonable use case for the current
implementation, it would be tempting to simply change it, or use a
FutureWarning (unfortunately forcing users to manually calculate the
density). If there is any half-decent use case, the kwarg may be the
nicer option.

Personally, if no one finds has a use case, I am slightly tending
towards the "bug fix" option right now.

All the Best,


[0] https://github.com/numpy/numpy/issues/13604
[1] As mentioned in the documentation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190531/114c3d3b/attachment.sig>

More information about the NumPy-Discussion mailing list