Answered You can hire a professional tutor to get the answer.
In [ ]: population.where('time', are.between(1800, 2006)).drop('geo').group('time', sum).plot(0) Make a function stats_for_year that takes a year and...
In [ ]:
population.where('time', are.between(1800, 2006)).drop('geo').group('time', sum).plot(0)
Make a function stats_for_year that takes a year and returns a table of statistics. The table it returns should have four
columns: geo, population_total, children_per_woman_total_fertility,
and child_mortality_under_5_per_1000_born. Each row should contain one Alpha-3
country code and three statistics: population, fertility rate, and child mortality for that year from
the population, fertility and child_mortality tables. Only include rows for which all
three statistics are available for the country and year.
In addition, restrict the result to country codes that appears in big_50, an array of the 50 most populous countries in 2010. This restriction will speed up computations later in the project.
In [ ]:
# We first make population table that only includes the
# 50 countries with the largest 2010 populations. We focus on
# these 50 countries only so that plotting later will run faster.
big_50 = population.where('time', 2010).sort(2, descending=True).take(np.arange(50)).column('geo')
population_of_big_50 = population.where('time', are.above(1959)).where('geo', are.contained_in(big_50))
def stats_for_year(year):
"""Return a table of the stats for each country that year."""
p = population_of_big_50.where('time', year).drop('time')
f = fertility.where('time', year).drop('time')
c = child_mortality.where('time', year).drop('time')
...
Try calling your function stats_for_year on any year between 1960 and 2010 in the cell below.
Try to understand the output of stats_for_year.
In [ ]:
...
In [ ]: