Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Language: Python 3.6.1 Interpreter: Anaconda 3.6.4 --- Program used: PyCharm --- Starter code: Shown below image --- --- Prov Pop2013 Physic2013 popu2017 phys2017 NL 527400
Language: Python 3.6.1
Interpreter: Anaconda 3.6.4
--- Program used: PyCharm --- Starter code: Shown below image ---
---
Prov Pop2013 Physic2013 popu2017 phys2017 NL 527400 1305 528800 1500 PE 145200 260 152000 290 NS 943000 2456 953900 2516 NB 755700 1729 759700 1765 QB 8151300 19501 8394000 20254 ON 13555800 28965 14193400 29898 MB 1265600 2546 1338100 2861 SK 1104800 2092 1163900 2387 AB 3998000 9149 4286100 9910 BC 4590100 10528 4817200 11612 NT 43800 44 44500 166
Question 2 (13 points) Purpose: To practice Arithmetic with arrays. Degree of Difficulty: Easy In this question, you will use information from Canada Medical Association (CMA) to analyze Physician- Population ratio across all Canadian provinces from year 2013 to 2017. In year 2013 CMA planned to im prove this ratio by 5% in every province during next five years. You can find a tabular file a6q2. txt in starter folder on Moodle, with all the information that you require for this question. It has 5 columns: the province's abbreviated name, its population in year 2013, the number of physicians each province has in 2013, its pop- ulation in year 2017 and the number of physicians each province has in 2017 (a) Begin by opening and reading the file a6q2.txt into Python. (b) To assist with analysis, you will need the data stored in arrays. Create five arrays that hold the following information: the province strings, the populations in 2013, number of physicians in 2013, the population in 2017 and the number of physicians in 2017. The arrays should maintain the ordering of the file, so that the data for "NL' is first, followed by "PE" and so forth. Test this before you move on. (c) Calculate the population per physician for 2013 and 2017 both. This is easily done with a numpy array calculation. All these values will be float values at this point, but we need integer values to represent this physician-population ratio. Convert these values to integers by using the method numpy.around ) It will return the float rounded to the nearest integer (d) Calculate the rate of improvement in physician-population ratio in each province from 2013 to 2017 [Hint Formula to find rate of improvement is: (old value- new value)/old value) 100 (e) We will now use logical indexing to analyse our findings. Use a relational expression to create a boolean array, where True indicates that the physician-population ration has been increased by at least 5% and False if it is not. (f) Also create a boolean array that checks if the rate of improvement in physician-population ration is equal to or less than zero for each province. Your results should indicate that all of the provinces except Ontario have improved their ratio. (g) Finally. we need to report our findings by printing the information to the console. Display the ratios for both year as well as the rate of improvement as shown below Sample Run Here is an example execution of the required program. The formatting of your program's output should be similar to this example In NL population per physician was 404 in 2013 and 353 in 2017 Based on these ratio, the rate of improvement is 12.74% In PE population per physician was 559 in 2013 and 524 in 2017 Based on these ratio, the rate of improvement is 6.24% In NS population per physician was 384 in 2013 and 379 in 2017 Based on these ratio, the rate of improvement is 1.27% In NB population per physician was 437 in 2013 and 430 in 2017 Based on these ratio, the rate of improvement is 1.50% In QB population per physician was 418 in 2013 and 414 in 2017 Based on these ratio, the rate of improvement is 0.85% In ON population per physician was 468 in 2013 and 475 in 2017 Based on these ratio, the rate of improvement is -1.44% In MB population per physician was 497 in 2013 and 468 in 2017 Based on these ratio, the rate of improvement is 5.89% In SK population per physician was 528 in 2013 and 488 in 2017 Based on these ratio, the rate of improvement is 7.65% In AB population per physician was 437 in 2013 and 433 in 2017 Based on these ratio, the rate of improvement is 1.03%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