world6region column classifies each country into a region of the world Run the

World6region column classifies each country into a

This preview shows page 10 - 15 out of 15 pages.

world_6region column classifies each country into a region of the world. Run the cell below to inspect the data. In [39]: countries = Table.read_table('countries.csv').where('country', are.contained_in(population.group('geo').column(0))) countries.select('country', 'name', 'world_6region')
Image of page 10
Out[39]: country name world_6region afg Afghanistan south_asia akr_a_dhe Akrotiri and Dhekelia europe_central_asia alb Albania europe_central_asia dza Algeria middle_east_north_africa asm American Samoa east_asia_pacific and Andorra europe_central_asia ago Angola sub_saharan_africa aia Anguilla america atg Antigua and Barbuda america arg Argentina america ... (245 rows omitted) Question 2.3. Create a table called region_counts that has two columns, region and count . It should describe the count of how many countries in each region appear in the result of stats_for_year(1960) . For example, one row would have south_asia as its world_6region value and an integer as its count value: the number of large South Asian countries for which we have population, fertility, and child mortality numbers from 1960. In [48]: region_counts = stats_for_year(1960).select('geo').relabel('geo', 'country').join('country',countries,'country').relabel('world_6region','region').sel ect('region').group('region') region_counts Out[48]: region count america 8 east_asia_pacific 10 europe_central_asia 10 middle_east_north_africa 7 south_asia 5 sub_saharan_africa 10 In [49]: _ = ok.grade('q2_3') ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running tests --------------------------------------------------------------------- Test summary
Image of page 11
Passed: 2 Failed: 0 [ooooooooook] 100.0% passed The following scatter diagram compares total fertility rate and child mortality rate for each country in 1960. The area of each dot represents the population of the country, and the color represents its regionof the world. Run the cell. Do you think you can identify any of the dots?
Image of page 12
The result of the cell below is interactive. It may take several minutes to run because it computers 55 tables (one for each year). When it's done, a scatter plot and a slider should appear.Drag the slider to the right to see how countries have changed over time. You'll find that the great divide between so-called "Western" and "developing" countries that existed in the 1960's has nearly disappeared. This shift in fertility rates is the reason that the global population is expected to grow more slowly in the 21st century than it did in the 19th and 20th centuries.In [51]:import ipywidgets as widgets# This part takes a few minutes to run because it # computes 55 tables in advance: one for each year.for year in np.arange(1960, 2016):stats_relabeled(year)_ = widgets.interact(fertility_vs_child_mortality, year=widgets.IntSlider(min=1960, max=2015, value=1960))SubmissionCongratulations, you're done with lab 5 and Data 8.1x! Be sure torun all the tests and verify that they all pass(the next cell has a shortcut for that), Review the notebook one last time, we will be grading the final state of your notebook after the deadline, Save and Checkpointfrom the Filemenu, Now is a great time to watch the same data presented by Hans Rosling in a 2010 TEDx talk with smoother animation and witty commentary.
Image of page 13
Congratulations on finishing Data 8.1X!
Image of page 14
Image of page 15

You've reached the end of your free preview.

Want to read all 15 pages?

  • Fall '17
  • Demography, World population, Test Summary

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes