I have an array A which I am trying to put into 10 bins. Here is what I've done.
A = range(1,94)
hist = np.histogram(A, bins=10)
np.digitize(A, hist[1])
But the output has 11 bins, not 10, with the last value (93) placed in bin 11, when it should have been in bin 10. I can fix it with a hack, but what's the most elegant way of doing this? How do I tell digitize that the last bin in hist[1] is inclusive on the right - [ ] instead of [ )?
See Question&Answers more detail:os