Answered step by step
Verified Expert Solution
Question
1 Approved Answer
indicators.txt countries.txt IMPORTANT: For the questions below: Do not use any loops. All data extraction can be done using Boolean/relational indexing. You may assume that
indicators.txt
countries.txt
IMPORTANT: For the questions below: Do not use any loops. All data extraction can be done using Boolean/relational indexing. You may assume that the indicators/countries are sorted by GDP in ascending order. You may not assume the set of countries or the position of the country in the files. You may only use functionality discussed in CS115. TIPS: np.set_printoptions (suppress=True): displays the float values in the console with n decimal places, suppresses the scientific/exponential notation. The subplot function returns an axis object. The hist function returns a tuple containing the counts and bin edge values of a histogram. You can set the tick marks of the histogram to the edge values using the following statements: ax = plt.subplot (...) data plt.hist (...) ax.set_xticks ( data[1] ) 1. Download the files: indicators.txt and countries.txt, the data in the files is parallel, meaning the name and region of a country in the countries.txt file is at the same position/index as the indicator data in indicators.txt. 2. Create a Python script that does the following: a. Using loadtxt, load the country/region data into a numpy array, countries, and the indicator data into a numpy array, indicators. b. Select all rows from indicators where the GDP is below 1000 and store as indicators_under_1000. C. Store the country/region data (europe_countries) and indicator data (europe_data) for all countries in Europe. d. Select the male and female employment indicators for Turkey and store as turkey_employment_data. e. Using the data from the appropriate numpy arrays, create the plots shown below. Figure 1 - +Q Life Expectancy for Europe by Gender Infant Mortality with GDP under 1000 Men Women 140 70 120 60 50 100 Life Expectancy 40 Infant Mortality 80 60 20 40 10 0 20 Europe Male Europe Female 200 400 800 1000 600 GOP Figure 2 X Employment Rates by Gender in Turkey Male 71.3% 28.7% Female Frequency of Fertility Rates for All Countries (4 bins) 20 15 10 5 0 1.22 2.59 3.96 5.32 6.69 infantMortality GDPperCapita maleEmployed femaleEmployed illiteracyMale illiteracyFemale 67.5 fertility_per_woman 6.06 4 2.8 6.69 11 9.9 6.57 3.3 2 6.28 5.1 4 5.2 6.1 4 1.9 10.1 10.4 3.85 8.9 9.4 2.32 9.4 9.7 3.4 10.8 8.8 3.56 9 8.6 2.63 10.4 9.5 3.62 11 11 3.8 11.4 11.7 4.46 11.5 10.8 2.8 11.1 11.3 1.45 11.8 12.5 3.81 11.1 9.9 1.4 11.5 11.4 3.09 9.6 9.9 1.4 11.1 11.7 2.44 10.8 11.1 4.17 9.2 9.1 1.55 10.9 11.7 1.3 12.2 12.9 2.98 12.9 11.8 3.66 10.6 10.4 2.5 10.6 8.7 1.65 13 13.3 3.81 13 13.2 2.98 10.2. 10.7 4.45 10.5 10.7 1.6 11.5 11.7 2.1 10.1 11.3 1.4 12.3 12.6 2.44 11.8 11.7 5.9 9 8.4 1.38 13.9 13.6 2.1 13.7 13.1 2.97 12.6 13.3 1.65 15.1 13.9 1.48 13.9 14.7 5.25 9.4 7.1 1.95 12.1 13.2 3.77 10.6 11.6 1.22 15.1 15.9 2.77 8.9 9.1 2.7 11.8 12.1 3.46 9.8 10.3 1.32 12.6 12.7 1.96 15.4 16.2 educationMale 45.5 48.4 40.3 41.1 45.1 47 45.5 48.8 45.4 48.7 68.5 76.7 65.8 70.6 61.1 67.9 64.7 67.3 65.5 67.5 63.3 67 66.6 70.2 71.1 57.7 62.3 68.9 73.1 67.8 74.9 67.5 70.3 66 73.2 66.5 72.5 62.5 74.3 72.4 76.8 67.5 72 74.2 78 63.9 75 65.9 79.9 73.4 76.1 66.5 71.7 66.7 75.7 62.3 68.3 70 75.7 48.9 51.7 68.1 76.5 71.5 76.2 64.5 73.8 72.3 78.3 69.9 73.4 75.5 80.6 74.6 79.1 71.1 75.3 68.8 76 71.8 78.9 60.9 63.9 70.5 77.1 70 75.4 74.5 81.5 74.1 78.2 73.4 78.1 73.9 76.5 76.1 81.8 73.4 80.1 education Female lifeMale 110 77 88.2 86.5 142 142 80.6 75.3 97 165 88.9 79.4 114 205 90.1 90.6 122 321 70.2 44.8 23 343 75 58 44 464 84.5 33.4 58 726 81.2 39.3 54 973 73.4 21.6 41 994 85.1 41.1 48 1019 84.8 51.3 35 1093 82.7 49 58 1106 77.3 40.2 65 1389 64.3 27.7 34 1508 82.6 42.9 16 1518 60.7 53.8 44 1531 76.4 7.8 24 1570 72.7 57.4 39 1660 79.8 40.6 16 1764 69.8 51.5 12 1779 74 62.4 39 1860 85.7 26.1 9 9 1983 72.6 41.2 12 2433 71.5 54.1 45 2497 51.2 33.9 30 2569 79 34 44 2814 75.9 30.6 13 3058 66.2 48 3230 79.6 50.4 21 3496 82.1 41.2 56 3640 75.4 41.7 19 4014 64.1 44 14 4083 75.5 44.9 14 4325 61.1 43.4 13 4736 75.5 34.5 23 6583 78.8 6.9 8 8684 64.7 36.1 8 8793 74.1 27.4 18 9073 88.2 29.2 9 9736 76.1 48.7 8 10428 67 49.2 95 11308 74 10.3 14 12545 81.2 67 17 14013 93 27.5 7 14111 63.1 37 14 15757 80.1 34.3 9 16683 82.2 46.4 15 17690 92.5 24.2 5 22898 76 47.8 7 26037 74.9 59.3 lifeFemale 42.3 76.7 28.1 58.2 70.5 90.8 50.7 77.5 47.2 75.1 0.3 0.6 35.4 33.4 1.4 2.5 36.4 61.2 18.6 36.2 10.4 22 5 5.7 1.848 1.656 22 24.4 18 17.8 0.924 2.376 26.1 51 1.1 3.1 26.5 30.2 0.2 0.3 19.2 10.9 6.5 9.4 3.8 4.7 0.2 0.2 5.5 17 21.252 23.472 8.3 27.6 0.3 0.3 18.1 18.3 8.2 9.7 19.5 40.1 0.924 4.32 1.2 3 0.7 1 4.6 5 28.5 49.8 1.7 4.7 10.758 11.088 10.9 20.6 0.7 3.3 7.5 13 29.3 55 1.5 2 20.8 20.1 1.8 3.9 17.8 25.1 7.4 16.6 21.1 20.2 4 11.8 2.244 2.232 51 America region Mozambique Africa Malawi Africa Burkina Faso Africa Burundi Africa Azerbaijan Asia Georgia Asia Nicaragua America Guyana America Egypt Africa Belarus Europe Indonesia Asia Philippines Asia Samoa Oceania Swaziland Africa Dominican Republic Bulgaria Europe Algeria Africa Romania Europe El Salvador America Latvia Europe Jamaica America Paraguay America Cuba America Estonia Europe Peru America Belize America Turkey Asia Poland Europe South Africa Africa Venezuela America Botswana Africa Croatia Europe Trinidad and Tobago Hungary Europe Chile America Saudi Arabia Asia Greece Europe Malta Europe Bahrain Asia Korea, Republic.of Portugal Europe Iraq Asia Bahamas America Qatar Asia Spain Europe Kuwait Asia Brunei Asia United Arab Emirates Hong Kong Asia United States America America Asia Asia
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