Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python jupyter answer question 7. Need to debug. Question 5. Complete the function fertility_over_time. It takes the Alpha-3 code of a country as country_code and
python jupyter answer question 7. Need to debug.
Question 5. Complete the function fertility_over_time. It takes the Alpha-3 code of a country as country_code and a with labels and Children per woman with one row per year starting with (and including) the year and including all later years in the fertility table. Then, set to the Alpha-3 code for Poland. The provided call fertility_over_time(poland_code, 1950) returns a table that shows Poland's annual fertility rates since 1950 Hint: Read about tbl. relabeled in the Python Reference to rename columns. def fertility_over_time(country_code,_start): country_fertility=fertility.where('geo', country_code) country_fertility_after_start=country_fertility.where('time', are.above_or_equal_to(start)) table=country_fertility_after_start.drop( ).relabeled('time', 'Year').relabeled('children_per_woman_total_fertility', 'Children per_woman') return table poland_code = 'pol' fertility_over_time('pol', 1950) ... (61 rows omitted) Question 7. Create a table poland_since_1950 that contains one row per year starting with 1950 and: - A column Year containing the year - A column Children per woman describing total fertility in Poland that year - A column Child deaths per 1000 born describing child mortality in Poland that year def fertility_over_time(country_code, start): pol_fertility = fertility.where("geo", country_code) pol_fertility.relabel("geo", "country_code") pol_fertility_after = pol_fertility.where("time", are.above_or_equal_to(start)) pol_fertility_after = pol_fertility_after.drop(0).relabel("time", "Year").relabel("children_per_woman_total_fertility", "Children per_woman") return pol_fertility_after poland_code = 'pol' pol_fertility = fertility_over_time(poland_code, 1950) pol_mortality = mortality,where('country', 'Poland') pol_mortality = pol_mortality.where('time', are.above_or_equal_to(1950)) pol_mortality = pol_mortality.drop(0,1, 3, 5, 6) pol_mortality.relabel('time', 'Year') pol_mortality.relabel('deaths_per_1000_live_births', 'Child deaths per_1000 born') poland_since_1950 = pol_fertility.join('Year', pol_mortality) poland_since_1950 NameError Traceback (most recent call last) Cell In [43], line 11 8 poland_code = 'pol' 9 pol_fertility = fertility_over_time(poland_code, 1950) --> 11 pol_mortality = mortality.where ('country', 'Poland') 12 pol_mortality = pol_mortality where('time', are.above_or_equal_to(1950)) 13 pol_mortality = pol_mortality drop(,1,3,5,6) NameError: name 'mortality' is not defined grader.check ("q1_7")Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started