In [81]:
import pandas as pd
import numpy as np
import matplotlib as plt
%matplotlib inline
In [82]:
WHO_df = pd.read_csv("xmart.csv")
In [83]:
print WHO_df.head()
In [84]:
Age=[]
measure = []
for instance in WHO_df['Indicator; Age Group']:
Age.append(instance.split(';')[-1])
measure.append(instance.split('-')[0])
WHO_df['Age Group'] = Age
WHO_df['Indicator'] = measure
In [85]:
WHO_df.drop(['Indicator; Age Group'],axis=1,inplace=True)
In [86]:
WHO_df.head()
Out[86]:
In [87]:
WHO_df.to_csv('WHO_data.csv')
In [88]:
print "Getting Number of people lived above a age threshold"
req_df=WHO_df.where(WHO_df['Indicator']=='Tx ').dropna()
In [89]:
req_df.to_csv('Life Expectation.csv')
In [90]:
req_df.keys()
Out[90]:
In [91]:
print "Getting Number of people lived above a age threshold"
req_df=WHO_df.where(WHO_df['Indicator']=='ex ').dropna()
In [92]:
req_df.to_csv('Exp Life.csv')
In [93]:
print "Getting Death Rate above a age threshold"
req_df=WHO_df.where(WHO_df['Indicator']=='nMx ').dropna()
req_df.to_csv('Death Rate.csv')
In [ ]: