Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SOLVE IN PYTHON 1. Use the first table (Subset A) to create a text file (listA)

ID: 3572429 • Letter: S

Question

SOLVE IN PYTHON

1. Use the first table (Subset A) to create a text file (listA) with a list of the 10 countries and its corresponding percents in a random order.

2. Use the second table (Subset B) to create a text file (listB) with a list of the 10 countries and its corresponding population affected in a random order.

3. Create a code in python that reads the text file (listA) and sorts it by percent (from high to low) and then create a bar graph from the results

4. Create a code in python that reads the text file (listB) and sorts it by population affected (from high to low) and then create a bar graph from the results

5. Take the top 5 results from listA and listB nd create a list C

6. Create a code that makes a graph with the countries from this new list C and creates a bar graph or graph of some sort that distinguishably shows each countries corresponding total population, population affected and percent.

Subset A COUNTRY Tokelau Western Pacific 30% 375 Nauru Western Pacific 10,222 2,464 Mauritius Africa 22.5% 1.273.212 283,926 Cook Islands Western Pacific 215% 20,833 4479 Western Pacific 21.3% S2.993 11.28 Marshall Islands Palau Western Pacific 20.9% 21,291 4450 Saudi Arabia Middle East & North 31,540,372 4007,146 Middle East & North 801,429 Middle East & North New Caledonia Western Pacific 19.6% Subset B AFFECTED China Western Pacific 9.8% 13 billion 90 million India South-east Asia 9.3% 1.3 bilion 61.3 million Middle East & North 320 million 23.7 million United States Europe 8.8% 113 million Russian Federation 12.6 million South/Central 207 million 12.4 million Lapan Western Pacific S7% 126 million 10.7 million Middle East & North 127 million 10.3 million Mexico Bangladesh South-east Asia 8.3% 161 million 8.4 million Middle East/ North 16.7% 92 million 7.3 million Western Pacific S% 2s8 million L7.3 million Indonesia

Explanation / Answer

import pandas as pd

Subset_A=pd.read_csv('Subset A.csv')

Subset_B=pd.read_csv('Subset B.csv')

#Sorting Subset A

Subset_A=Subset_A.sort_values('PERCENT ')

#Sorting Subset B
Subset_B=Subset_B.sort_values('PERCENT ')

import matplotlib.pyplot as plt

X=Subset_A['TOTAL POPULATION']
Y=Subset_A['PERCENT ']

plt.bar(X, Y, width,color="blue")

A=Subset_B['TOTAL POPULATION']
B=Subset_B['PERCENT ']

plt.bar(A, B, width,color="blue")