Guest User

Untitled

a guest
Oct 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. In the video, you saw population pyramids for the present day and for the future.
  2. Because we were using a histogram, it was very easy to make a comparison.
  3. Let's do a similar comparison. life_exp contains life expectancy data for different countries in 2007.
  4. You also have access to a second list now, life_exp1950, containing similar data for 1950. Can you make a histogram for both datasets?
  5. You'll again be making two plots. The plt.show() and plt.clf() commands to render everything nicely are already included.
  6. Also matplotlib.pyplot is imported for you, as plt.
  7.  
  8. Build a histogram of life_exp with 15 bins.
  9. Build a histogram of life_exp1950, also with 15 bins. Is there a big difference with the histogram for the 2007 data?
  10.  
  11. # Histogram of life_exp, 15 bins
  12. plt.hist(life_exp,bins=15)
  13.  
  14. # Show and clear plot
  15. plt.show()
  16. plt.clf()
  17.  
  18. # Histogram of life_exp1950, 15 bins
  19. plt.hist(life_exp1950,bins=15)
  20.  
  21. # Show and clear plot again
  22. plt.show()
  23. plt.clf()
Add Comment
Please, Sign In to add comment