The figure below displays the graph that you created in the last exercise:
This histogram is helpful for our store manager. The last six hours of the day are the busiest — from 6 pm until midnight. Does this mean the manager should staff their grocery store with the most employees between 6 pm and midnight?
To the manager, this doesn’t make much sense. The manager knows the store is busy when many people get off work, but the rush certainly doesn’t continue later than 9 pm.
The issue with this histogram is that we have too few bins. When plotting a histogram, it’s essential to select bins that fully capture the trends in the underlying data. Often, this will require some guessing and checking. There isn’t much of a science to selecting bin size.
How many bins do you think makes sense for this example? I would try 24 because there are 24 hours in a day.
Change the number of bins in your code from 4 to 24.
What do you notice about the data?
Given this new graph, when would you recommend staffing the grocery store?
Check the hint to see what we thought.