-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
numpy.histogram produces bins such that:
All but the last (righthand-most) bin is half-open. In other words, if bins is:
[1, 2, 3, 4]
then the first bin is [1, 2) (including 1, but excluding 2) and the second [2, 3). The last bin, however, is [3, 4], which includes 4.
numpy.digitize interprets the bin argument as:
Each index i returned is such that bins[i-1] <= x < bins[i] if bins is monotonically increasing, or bins[i-1] > x >= bins[i] if bins is monotonically decreasing.
It would be convenient if numpy.digitize could be configured to interpret bins as the way that numpy.histogram produces them. Maybe change or replace the right argument to be interval=None|'left'|'right'|'leftclosed'|'rightclosed', where 'leftclosed' would behave as numpy.histogram does.