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()


                                Indicator; Age Group  2013; Female  \
0  nMx - age-specific death rate between ages x a...      0.005325   
1  nMx - age-specific death rate between ages x a...      0.000226   
2  nMx - age-specific death rate between ages x a...      0.000107   
3  nMx - age-specific death rate between ages x a...      0.000123   
4  nMx - age-specific death rate between ages x a...      0.000313   

   2013; Male  2012; Female  2012; Male  2000; Female  2000; Male  \
0    0.006437      0.005527    0.006639      0.006437    0.007754   
1    0.000302      0.000226    0.000301      0.000302    0.000403   
2    0.000128      0.000109    0.000131      0.000140    0.000176   
3    0.000175      0.000125    0.000177      0.000161    0.000243   
4    0.000767      0.000318    0.000782      0.000393    0.000933   

   1990; Female  1990; Male  
0      0.008363    0.010498  
1      0.000429    0.000531  
2      0.000185    0.000256  
3      0.000202    0.000316  
4      0.000464    0.001273  

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]:
2013; Female 2013; Male 2012; Female 2012; Male 2000; Female 2000; Male 1990; Female 1990; Male Age Group Indicator
0 0.005325 0.006437 0.005527 0.006639 0.006437 0.007754 0.008363 0.010498 1 year nMx
1 0.000226 0.000302 0.000226 0.000301 0.000302 0.000403 0.000429 0.000531 1-4 years nMx
2 0.000107 0.000128 0.000109 0.000131 0.000140 0.000176 0.000185 0.000256 5-9 years nMx
3 0.000123 0.000175 0.000125 0.000177 0.000161 0.000243 0.000202 0.000316 10-14 years nMx
4 0.000313 0.000767 0.000318 0.000782 0.000393 0.000933 0.000464 0.001273 15-19 years nMx

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()


Getting Number of people lived above a age threshold

In [89]:
req_df.to_csv('Life Expectation.csv')

In [90]:
req_df.keys()


Out[90]:
Index([u'2013; Female', u'2013; Male', u'2012; Female', u'2012; Male',
       u'2000; Female', u'2000; Male', u'1990; Female', u'1990; Male',
       u'Age Group', u'Indicator'],
      dtype='object')

In [91]:
print "Getting Number of people lived above a age threshold"
req_df=WHO_df.where(WHO_df['Indicator']=='ex ').dropna()


Getting Number of people lived above a age threshold

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')


Getting Death Rate above a age threshold

In [ ]: