Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
These are the marks of 30 students out of 100: 35, 48, 52, 55, 58, 61, 62, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 78, 80, 82, 85, 88, 90, 92, 45, 54, 69, 77. Count how many marks fall in the bins 0 to 20, 20 to 40, 40 to 60, 60 to 80 and 80 to 100. Which bin is the fullest? Draw the histogram and mark the mean.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Plan. np.histogram with the edges of the bins gives the counts. A mark that is exactly on an edge goes into the bin on its right (the last bin includes its right end).
Check. The counts are 0, 1, 6, 17 and 6, and they add up to 30. The marks from 60 to 79 are the fullest bin: 17 students. The mean is 68.4.
Answer: [ 0 1 6 17 6]. The fullest bin is 60 to 80, and the mean is 68.4.
Log in to join the discussion.
Loading…