Question: Question 2. Assigninitialto an array that contains the population for every five year interval from 1970 to 2010. Then, assignchangedto an array that contains the
Question 2.Assigninitialto an array that contains the population for every five year interval from 1970 to 2010. Then, assignchangedto an array that contains the population for every five year interval from 1975 to 2015. You should use theb_fivetable to create both arrays, first filtering the table to only contain the relevant years.
We have provided the code below that usesinitialandchangedin order to add a column tob_fivecalledannual_growth. Don't worry about the calculation of the growth rates; run the test below to test your solution.
If you are interested in how we came up with the formula for growth rates, consult thegrowth ratessection of the textbook.
In[13]:
initial = ... changed = ... b_1970_through_2010 = b_five.where('time', are.below_or_equal_to(2010)) b_five_growth = b_1970_through_2010.with_column('annual_growth', (changed/initial)**0.2-1) b_five_growth.set_format('annual_growth', PercentFormatter) Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
