Skip to content

Commit

Permalink
update country data
Browse files Browse the repository at this point in the history
  • Loading branch information
semio committed Feb 25, 2016
1 parent 0e3adfd commit 98de5e0
Show file tree
Hide file tree
Showing 2 changed files with 582 additions and 248 deletions.
334 changes: 334 additions & 0 deletions WDI.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4856,6 +4856,340 @@
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# country entities"
]
},
{
"cell_type": "code",
"execution_count": 336,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"country.columns = list(map(to_concept_id, country.columns))"
]
},
{
"cell_type": "code",
"execution_count": 337,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>country_code</th>\n",
" <th>short_name</th>\n",
" <th>table_name</th>\n",
" <th>long_name</th>\n",
" <th>2_alpha_code</th>\n",
" <th>currency_unit</th>\n",
" <th>special_notes</th>\n",
" <th>region</th>\n",
" <th>income_group</th>\n",
" <th>wb_2_code</th>\n",
" <th>...</th>\n",
" <th>imf_data_dissemination_standard</th>\n",
" <th>latest_population_census</th>\n",
" <th>latest_household_survey</th>\n",
" <th>source_of_most_recent_income_and_expenditure_data</th>\n",
" <th>vital_registration_complete</th>\n",
" <th>latest_agricultural_census</th>\n",
" <th>latest_industrial_data</th>\n",
" <th>latest_trade_data</th>\n",
" <th>latest_water_withdrawal_data</th>\n",
" <th>country</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>ABW</td>\n",
" <td>Aruba</td>\n",
" <td>Aruba</td>\n",
" <td>Aruba</td>\n",
" <td>AW</td>\n",
" <td>Aruban florin</td>\n",
" <td>SNA data for 2000-2011 are updated from offici...</td>\n",
" <td>Latin America &amp; Caribbean</td>\n",
" <td>High income: nonOECD</td>\n",
" <td>AW</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>2010</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Yes</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2012</td>\n",
" <td>NaN</td>\n",
" <td>abw</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>ADO</td>\n",
" <td>Andorra</td>\n",
" <td>Andorra</td>\n",
" <td>Principality of Andorra</td>\n",
" <td>AD</td>\n",
" <td>Euro</td>\n",
" <td>NaN</td>\n",
" <td>Europe &amp; Central Asia</td>\n",
" <td>High income: nonOECD</td>\n",
" <td>AD</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>2011. Population data compiled from administra...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>Yes</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2006</td>\n",
" <td>NaN</td>\n",
" <td>ado</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>AFG</td>\n",
" <td>Afghanistan</td>\n",
" <td>Afghanistan</td>\n",
" <td>Islamic State of Afghanistan</td>\n",
" <td>AF</td>\n",
" <td>Afghan afghani</td>\n",
" <td>Fiscal year end: March 20; reporting period fo...</td>\n",
" <td>South Asia</td>\n",
" <td>Low income</td>\n",
" <td>AF</td>\n",
" <td>...</td>\n",
" <td>General Data Dissemination System (GDDS)</td>\n",
" <td>1979</td>\n",
" <td>Multiple Indicator Cluster Survey (MICS), 2010/11</td>\n",
" <td>Integrated household survey (IHS), 2008</td>\n",
" <td>NaN</td>\n",
" <td>2013/14</td>\n",
" <td>NaN</td>\n",
" <td>2013</td>\n",
" <td>2000</td>\n",
" <td>afg</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>AGO</td>\n",
" <td>Angola</td>\n",
" <td>Angola</td>\n",
" <td>People's Republic of Angola</td>\n",
" <td>AO</td>\n",
" <td>Angolan kwanza</td>\n",
" <td>April 2013 database update: Based on IMF data,...</td>\n",
" <td>Sub-Saharan Africa</td>\n",
" <td>Upper middle income</td>\n",
" <td>AO</td>\n",
" <td>...</td>\n",
" <td>General Data Dissemination System (GDDS)</td>\n",
" <td>2014</td>\n",
" <td>Malaria Indicator Survey (MIS), 2011</td>\n",
" <td>Integrated household survey (IHS), 2008/09</td>\n",
" <td>NaN</td>\n",
" <td>2015</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2005</td>\n",
" <td>ago</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>ALB</td>\n",
" <td>Albania</td>\n",
" <td>Albania</td>\n",
" <td>Republic of Albania</td>\n",
" <td>AL</td>\n",
" <td>Albanian lek</td>\n",
" <td>NaN</td>\n",
" <td>Europe &amp; Central Asia</td>\n",
" <td>Upper middle income</td>\n",
" <td>AL</td>\n",
" <td>...</td>\n",
" <td>General Data Dissemination System (GDDS)</td>\n",
" <td>2011</td>\n",
" <td>Demographic and Health Survey (DHS), 2008/09</td>\n",
" <td>Living Standards Measurement Study Survey (LSM...</td>\n",
" <td>Yes</td>\n",
" <td>2012</td>\n",
" <td>2011</td>\n",
" <td>2013</td>\n",
" <td>2006</td>\n",
" <td>alb</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 32 columns</p>\n",
"</div>"
],
"text/plain": [
" country_code short_name table_name long_name \\\n",
"0 ABW Aruba Aruba Aruba \n",
"1 ADO Andorra Andorra Principality of Andorra \n",
"2 AFG Afghanistan Afghanistan Islamic State of Afghanistan \n",
"3 AGO Angola Angola People's Republic of Angola \n",
"4 ALB Albania Albania Republic of Albania \n",
"\n",
" 2_alpha_code currency_unit \\\n",
"0 AW Aruban florin \n",
"1 AD Euro \n",
"2 AF Afghan afghani \n",
"3 AO Angolan kwanza \n",
"4 AL Albanian lek \n",
"\n",
" special_notes \\\n",
"0 SNA data for 2000-2011 are updated from offici... \n",
"1 NaN \n",
"2 Fiscal year end: March 20; reporting period fo... \n",
"3 April 2013 database update: Based on IMF data,... \n",
"4 NaN \n",
"\n",
" region income_group wb_2_code ... \\\n",
"0 Latin America & Caribbean High income: nonOECD AW ... \n",
"1 Europe & Central Asia High income: nonOECD AD ... \n",
"2 South Asia Low income AF ... \n",
"3 Sub-Saharan Africa Upper middle income AO ... \n",
"4 Europe & Central Asia Upper middle income AL ... \n",
"\n",
" imf_data_dissemination_standard \\\n",
"0 NaN \n",
"1 NaN \n",
"2 General Data Dissemination System (GDDS) \n",
"3 General Data Dissemination System (GDDS) \n",
"4 General Data Dissemination System (GDDS) \n",
"\n",
" latest_population_census \\\n",
"0 2010 \n",
"1 2011. Population data compiled from administra... \n",
"2 1979 \n",
"3 2014 \n",
"4 2011 \n",
"\n",
" latest_household_survey \\\n",
"0 NaN \n",
"1 NaN \n",
"2 Multiple Indicator Cluster Survey (MICS), 2010/11 \n",
"3 Malaria Indicator Survey (MIS), 2011 \n",
"4 Demographic and Health Survey (DHS), 2008/09 \n",
"\n",
" source_of_most_recent_income_and_expenditure_data \\\n",
"0 NaN \n",
"1 NaN \n",
"2 Integrated household survey (IHS), 2008 \n",
"3 Integrated household survey (IHS), 2008/09 \n",
"4 Living Standards Measurement Study Survey (LSM... \n",
"\n",
" vital_registration_complete latest_agricultural_census \\\n",
"0 Yes NaN \n",
"1 Yes NaN \n",
"2 NaN 2013/14 \n",
"3 NaN 2015 \n",
"4 Yes 2012 \n",
"\n",
" latest_industrial_data latest_trade_data latest_water_withdrawal_data \\\n",
"0 NaN 2012 NaN \n",
"1 NaN 2006 NaN \n",
"2 NaN 2013 2000 \n",
"3 NaN NaN 2005 \n",
"4 2011 2013 2006 \n",
"\n",
" country \n",
"0 abw \n",
"1 ado \n",
"2 afg \n",
"3 ago \n",
"4 alb \n",
"\n",
"[5 rows x 32 columns]"
]
},
"execution_count": 337,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"country.head()"
]
},
{
"cell_type": "code",
"execution_count": 339,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"cols = np.r_[country.columns[-1:], country.columns[:-1]]"
]
},
{
"cell_type": "code",
"execution_count": 342,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"country.loc[:, cols].to_csv('./output/ddf--entities--country.csv', index=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
Loading

0 comments on commit 98de5e0

Please sign in to comment.