Question: python error, need to change in initial and changed row Question 2. Assign initial to an array that contains the population for every five year
python error, need to change in initial and changed row


Question 2. Assign initial to an array that contains the population for every five year interval from 1900 to 2015 (inclusive). Then, assign changed to an array that contains the population for every five year interval from 1905 to 2020 (inclusive). The first array should include both 1900 and 2015 , and the second array should include both 1905 and 2020. You should use the table to create both arrays, by first filtering the table to only contain the relevant years. The annual growth rate for a time period is equal to: ((PopulationatstartofperiodPopulationatendofperiod)numberofyears1)1 We have provided the code below that uses initial and changed in order to add a column to called annual_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 the growth rates section of the textbook. initial = p_five.where('time ', are.between_or_equal_to(1900, 2015)).column('population_total') changed = p_five.where('time', are.between_or_equal_to(1905, 2020)).column('population_total') P_1900_through_2015 = p_five.where('time', are.below_or_equal_to(2015)) P_five_growth = p_1900_through_2015.with_column('annual_growth', (changed/initial) P_five_growth.set_format('annual_growth', PercentFormatter) The annual growth rate in Poland has been declining since 1950 , as shown in the table below. P_pop.set_format ('population_total', Numberformatter) fives = np.arange(190e, 2021,5) \# 190e, 19e5, 191e, ... P_five = P_pop.sort('time').where('time', are.contained_in(fives)) P_five.show(3) (22 rows omitted ) Run the following cell to visualize the population over time. Following the devastating effects of World War I and World War II, Poland's population increased steadily from 1950 to 2000 and then leveled off. In the following questions we'll investigate this period of population growth
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
