Statistical Distributions with NumPy
Histograms, Part II

Suppose we had a larger dataset with values ranging from 0 to 50. We might not want to know exactly how many 0’s, 1’s, 2’s, etc. we have.

Instead, we might want to know how many values fall between 0 and 5, 6 and 10, 11 and 15, etc.

These groupings are called bins. All bins in a histogram are always the same size. The width of each bin is the distance between the minimum and maximum values of each bin. In our example, the width of each bin would be 5.

For a dataset like this, our histogram table would look like this:

Bin Number of Values
(0, 5) 2
(6, 10) 10
(11, 15) 11
(46, 50) 3

And if we were to graph this histogram, it would look like this: histogram



To your right, there is a new histogram representing a new dataset.

What is the width of each bin in this histogram? Save your answer to the variable width.


How many samples in this dataset fall between 10 and 15? Save your answer to the variable ans.

Folder Icon

Sign up to start coding

Already have an account?