import csv
from json import loads, dumps
import matplotlib.pyplot as plt
import numpy as np
w, h = 5, 5240;
matinil = [[0 for x in range(w)] for y in range(h)]
variable1990,variableco1,variableco2,variableco3,myred1,myred2,myred3=[],[],[],[],[],[],[]
variable2015,val1,val2,val3=[],0,0,0
j,k=0,0
# Start CSV Read
with open(‘WHOSIS_000003.csv’) as inputcsv:
datastore={}
WHOSIS1=[]
WHOSIS2=[]
WHOSIS3=[]
WHOSIS4=[]
WHOSIS5=[]
reader = csv.DictReader(inputcsv)
# DO the processing
for whorow in reader:
datastore=loads(dumps(whorow))
WHOSIS1.append(datastore[‘Country’])
WHOSIS2.append(datastore[‘Year’])
spl1=datastore[‘Infant mortality rate (probability of dying between birth and age 1 per 1000 live births)’]
spl2=spl1.split(‘[‘)
WHOSIS3.append(spl2[0])
spl1=datastore[‘Neonatal mortality rate (per 1000 live births)’]
spl2=spl1.split(‘[‘)
WHOSIS4.append(spl2[0])
spl1=datastore[‘Under-five mortality rate (probability of dying by age 5 per 1000 live births)’]
spl2=spl1.split(‘[‘)
WHOSIS5.append(spl2[0])
w, h = 10, 4442;
Matrix = [[0 for x in range(w)] for y in range(h)]
with open(‘COUNTRY.csv’) as csvfile:
myvals={} COUNTRYcomb1,COUNTRYcomb2,COUNTRYcomb3,COUNTRYcomb4,COUNTRYcomb5,COUNTRYcomb6,COUNTRYcomb7,COUNTRYcomb8,COUNTRYcomb9,COUNTRYcomb10=[],[],[],[],[],[],[],[],[],[]
reader = csv.DictReader(csvfile)
for row in reader:
myvals=loads(dumps(row))
COUNTRYcomb1.append(myvals[‘attribute__label’])
COUNTRYcomb2.append(myvals[‘attribute__display’])
COUNTRYcomb3.append(myvals[‘dimension__code__display’])
COUNTRYcomb4.append(myvals[‘dimension__code__attr__category’])
COUNTRYcomb5.append(myvals[‘dimension__code__attr__value’])
regionmat1,regionmat2,regionmat3,regionmat4,regionmat5=[],[],[],[],[]
incomemat1,incomemat2,incomemat3,incomemat4,incomemat5=[],[],[],[],[]
for i in range(len(COUNTRYcomb4)):
if ‘WORLD_BANK_INCOME_GROUP’ in COUNTRYcomb4[i]:
incomemat2.append(COUNTRYcomb2[i])
incomemat3.append(COUNTRYcomb3[i])
incomemat4.append(COUNTRYcomb4[i])
incomemat5.append(COUNTRYcomb5[i])
if ‘WORLD_BANK_INCOME_GROUP_RELEASE_DATE’ in COUNTRYcomb4[i]:
incomemat1.append(COUNTRYcomb5[i])
if ‘WHO_REGION_CODE’ in COUNTRYcomb4[i]:
regionmat1.append(COUNTRYcomb5[i])
if ‘WHO_REGION’ in COUNTRYcomb4[i]:
regionmat2.append(COUNTRYcomb2[i])
regionmat3.append(COUNTRYcomb3[i])
regionmat4.append(COUNTRYcomb4[i])
regionmat5.append(COUNTRYcomb5[i])
fig = plt.figure(figsize=(20,10))
plt.plot(incomemat5,marker=’o’,markerfacecolor=’red’)
plt.xlabel(” dimension__code__attr__category”)
plt.ylabel(“dimension__code__attr__value”)
plt.title(“WORLD_BANK_INCOME_GROUP value”)
plt.grid(b=None, which=’major’, axis=’both’)
fig = plt.figure(figsize=(20,10))
plt.plot(incomemat1,marker=’o’,markerfacecolor=’red’)
plt.xlabel(” dimension__code__attr__category”)
plt.ylabel(“dimension__code__attr__value”)
plt.title(“WORLD_BANK_INCOME_GROUP_RELEASE_DATE value”)
plt.grid(b=None, which=’major’, axis=’both’)
fig = plt.figure(figsize=(20,10))
plt.plot(regionmat1,marker=’o’,markerfacecolor=’red’)
plt.xlabel(” dimension__code__attr__category”)
plt.ylabel(“dimension__code__attr__value”)
plt.title(“WHO_REGION_CODE Value”)
plt.grid(b=None, which=’major’, axis=’both’)
fig = plt.figure(figsize=(20,10))
plt.plot(incomemat5,marker=’o’,markerfacecolor=’red’)
plt.xlabel(” dimension__code__attr__category”)
plt.ylabel(“dimension__code__attr__value”)
plt.title(“WORLD_BANK_INCOME_GROUP value”)
plt.grid(b=None, which=’major’, axis=’both’)
plt.show()