{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"**Chapter 1 – The Machine Learning landscape**\n",
"\n",
"_This is the code used to generate some of the figures in chapter 1._"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Setup"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"slideshow": {
"slide_type": "-"
}
},
"outputs": [],
"source": [
"# To support both python 2 and python 3\n",
"from __future__ import division, print_function, unicode_literals\n",
"\n",
"# Common imports\n",
"import numpy as np\n",
"import numpy.random as rnd\n",
"import os\n",
"\n",
"# to make this notebook's output stable across runs\n",
"rnd.seed(42)\n",
"\n",
"# To plot pretty figures\n",
"%matplotlib inline\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"plt.rcParams['axes.labelsize'] = 14\n",
"plt.rcParams['xtick.labelsize'] = 12\n",
"plt.rcParams['ytick.labelsize'] = 12\n",
"\n",
"# Where to save the figures\n",
"PROJECT_ROOT_DIR = \".\"\n",
"CHAPTER_ID = \"fundamentals\"\n",
"\n",
"def save_fig(fig_id, tight_layout=True):\n",
" path = os.path.join(PROJECT_ROOT_DIR, \"images\", CHAPTER_ID, fig_id + \".png\")\n",
" print(\"Saving figure\", fig_id)\n",
" if tight_layout:\n",
" plt.tight_layout()\n",
" plt.savefig(path, format='png', dpi=300)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Load and prepare Life satisfaction data"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"Before starting this exercise you should create a folder called `datasets` in the folder where this notebook is stored. We will be placing various data files in that folder, and the code below is written so as to look there. We will be making various subfolders in the `datasets` folder, and if you want, you can start by \n",
"creating the first one right away. It's called `lifesat`.\n",
"\n",
"So let's say your data is stored in a Unix type system in the folder `/Users/fred/Desktop/school/python_for_ss`. Then there is a subfolder of that called\n",
"`datasets` and a subfolder of **that** called `lifesat`. So the full path to the `lifesat` data looks\n",
"like this.\n",
"\n",
"```\n",
"/Users/fred/Desktop/school/python_for_ss/datasets/lifesat\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"The OECD (Organization for Economic Cooperation and Development) stats website contains all kinds if economic statistics on countries in downloadable form, in particular in a very popular stripped-down spreadsheet format call \".csv\" (for comma-separated values). You will get a local copy. The particular dataset we want is the BLI data (\"Better Life Index\"). \n",
"\n",
"It contains a number of economic and social variables used to estimate\n",
"\"Quality of Life\" in communities large and small. Try this now so you can have a local copy of this data\n",
"Visit [here](http://stats.oecd.org/index.aspx?DataSetCode=BLI) and choose the year 2015 so you get numbers like the ones below. Then pull down the export menu, and choose \n",
"CSV format. Download the file into a subfolder of the `datasets` folder called `lifesat`."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"# Download CSV from http://stats.oecd.org/index.aspx?DataSetCode=BLI\n",
"datapath = \"datasets/lifesat/\"\n",
"\n",
"oecd_bli = pd.read_csv(datapath+\"oecd_bli_2015.csv\", thousands=',')\n",
"oecd_bli = oecd_bli[oecd_bli[\"INEQUALITY\"]==\"TOT\"]"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"This table contains economic and social statistics for people in a number of countries. The `INEQUALITY` attribute\n",
"is for looking at subpopulations like low/high income, men/women. Since we won't be looking at those\n",
"sub-populations in this exercise, the first step after reading in the data is to reduce the table to those \n",
"rows containing statistics about the total population.\n",
"\n",
"The data in this big table is stored in an interesting and very popular format. Let's understand that \n",
"before moving on. First there are facts about 36 distinct countries. One of the names in the `Country`\n",
"column (`OECD - Total`) is a label under which totals for all the countries will be aggregated."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"37 countries in data\n",
"set(['Canada', 'Turkey', 'Italy', 'Czech Republic', 'Luxembourg', 'France', 'Slovak Republic', 'Ireland', 'Norway', 'Israel', 'Australia', 'Iceland', 'Slovenia', 'Germany', 'Chile', 'Belgium', 'Spain', 'Netherlands', 'Denmark', 'Poland', 'Finland', 'OECD - Total', 'United States', 'Sweden', 'Korea', 'Japan', 'Switzerland', 'New Zealand', 'Russia', 'Brazil', 'Estonia', 'Portugal', 'Mexico', 'United Kingdom', 'Austria', 'Greece', 'Hungary'])\n"
]
}
],
"source": [
"countries = set(oecd_bli['Country'])\n",
"print(len(countries), 'countries in data')\n",
"print (countries)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"The cell below shows what happens when we zoom in on one country, Poland. The table contains a number of rows with information about Poland, each with a different value in the `INDICATOR` column (code name) or `Indicator` column (English name). That is the name of some statistic about Poland. The numerical value for that statistic is in the `Value` column and the unit for that statistic and the unit is in the `UNIT CODE` (or `Unit`) column. So the first row printed out tells us that 3.2% of all households in Poland are dwellings without basic facilities, an indicator of substantial poverty."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"
\n",
" \n",
" \n",
" | \n",
" LOCATION | \n",
" Country | \n",
" INDICATOR | \n",
" Indicator | \n",
" MEASURE | \n",
" Measure | \n",
" INEQUALITY | \n",
" Inequality | \n",
" Unit Code | \n",
" Unit | \n",
" PowerCode Code | \n",
" PowerCode | \n",
" Reference Period Code | \n",
" Reference Period | \n",
" Value | \n",
" Flag Codes | \n",
" Flags | \n",
"
\n",
" \n",
" \n",
" \n",
" 21 | \n",
" POL | \n",
" Poland | \n",
" HO_BASE | \n",
" Dwellings without basic facilities | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 3.20 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 130 | \n",
" POL | \n",
" Poland | \n",
" HO_HISH | \n",
" Housing expenditure | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 21.00 | \n",
" E | \n",
" Estimated value | \n",
"
\n",
" \n",
" 239 | \n",
" POL | \n",
" Poland | \n",
" HO_NUMR | \n",
" Rooms per person | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" RATIO | \n",
" Ratio | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 1.10 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 348 | \n",
" POL | \n",
" Poland | \n",
" IW_HADI | \n",
" Household net adjusted disposable income | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" USD | \n",
" US Dollar | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 17852.00 | \n",
" E | \n",
" Estimated value | \n",
"
\n",
" \n",
" 531 | \n",
" POL | \n",
" Poland | \n",
" IW_HNFW | \n",
" Household net financial wealth | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" USD | \n",
" US Dollar | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 10919.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 640 | \n",
" POL | \n",
" Poland | \n",
" JE_EMPL | \n",
" Employment rate | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 60.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 825 | \n",
" POL | \n",
" Poland | \n",
" JE_JT | \n",
" Job security | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 7.30 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 936 | \n",
" POL | \n",
" Poland | \n",
" JE_LTUR | \n",
" Long-term unemployment rate | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 3.77 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 1121 | \n",
" POL | \n",
" Poland | \n",
" JE_PEARN | \n",
" Personal earnings | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" USD | \n",
" US Dollar | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 22655.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 1306 | \n",
" POL | \n",
" Poland | \n",
" SC_SNTWS | \n",
" Quality of support network | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 91.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 1473 | \n",
" POL | \n",
" Poland | \n",
" ES_EDUA | \n",
" Educational attainment | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 90.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 1584 | \n",
" POL | \n",
" Poland | \n",
" ES_STCS | \n",
" Student skills | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" AVSCORE | \n",
" Average score | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 521.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 1769 | \n",
" POL | \n",
" Poland | \n",
" ES_EDUEX | \n",
" Years in education | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" YR | \n",
" Years | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 18.40 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 1880 | \n",
" POL | \n",
" Poland | \n",
" EQ_AIRP | \n",
" Air pollution | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" MICRO_M3 | \n",
" Micrograms per cubic metre | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 33.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 1989 | \n",
" POL | \n",
" Poland | \n",
" EQ_WATER | \n",
" Water quality | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 79.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 2100 | \n",
" POL | \n",
" Poland | \n",
" CG_TRASG | \n",
" Consultation on rule-making | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" AVSCORE | \n",
" Average score | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 10.80 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 2209 | \n",
" POL | \n",
" Poland | \n",
" CG_VOTO | \n",
" Voter turnout | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 55.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 2394 | \n",
" POL | \n",
" Poland | \n",
" HS_LEB | \n",
" Life expectancy | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" YR | \n",
" Years | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 76.90 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 2505 | \n",
" POL | \n",
" Poland | \n",
" HS_SFRH | \n",
" Self-reported health | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 58.00 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 2690 | \n",
" POL | \n",
" Poland | \n",
" SW_LIFS | \n",
" Life satisfaction | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" AVSCORE | \n",
" Average score | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 5.80 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 2869 | \n",
" POL | \n",
" Poland | \n",
" PS_SFRV | \n",
" Assault rate | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 1.40 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 2980 | \n",
" POL | \n",
" Poland | \n",
" PS_REPH | \n",
" Homicide rate | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" RATIO | \n",
" Ratio | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 0.90 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 3091 | \n",
" POL | \n",
" Poland | \n",
" WL_EWLH | \n",
" Employees working very long hours | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" PC | \n",
" Percentage | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 7.41 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
" 3202 | \n",
" POL | \n",
" Poland | \n",
" WL_TNOW | \n",
" Time devoted to leisure and personal care | \n",
" L | \n",
" Value | \n",
" TOT | \n",
" Total | \n",
" HOUR | \n",
" Hours | \n",
" 0 | \n",
" units | \n",
" NaN | \n",
" NaN | \n",
" 14.20 | \n",
" NaN | \n",
" NaN | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" LOCATION Country INDICATOR Indicator \\\n",
"21 POL Poland HO_BASE Dwellings without basic facilities \n",
"130 POL Poland HO_HISH Housing expenditure \n",
"239 POL Poland HO_NUMR Rooms per person \n",
"348 POL Poland IW_HADI Household net adjusted disposable income \n",
"531 POL Poland IW_HNFW Household net financial wealth \n",
"640 POL Poland JE_EMPL Employment rate \n",
"825 POL Poland JE_JT Job security \n",
"936 POL Poland JE_LTUR Long-term unemployment rate \n",
"1121 POL Poland JE_PEARN Personal earnings \n",
"1306 POL Poland SC_SNTWS Quality of support network \n",
"1473 POL Poland ES_EDUA Educational attainment \n",
"1584 POL Poland ES_STCS Student skills \n",
"1769 POL Poland ES_EDUEX Years in education \n",
"1880 POL Poland EQ_AIRP Air pollution \n",
"1989 POL Poland EQ_WATER Water quality \n",
"2100 POL Poland CG_TRASG Consultation on rule-making \n",
"2209 POL Poland CG_VOTO Voter turnout \n",
"2394 POL Poland HS_LEB Life expectancy \n",
"2505 POL Poland HS_SFRH Self-reported health \n",
"2690 POL Poland SW_LIFS Life satisfaction \n",
"2869 POL Poland PS_SFRV Assault rate \n",
"2980 POL Poland PS_REPH Homicide rate \n",
"3091 POL Poland WL_EWLH Employees working very long hours \n",
"3202 POL Poland WL_TNOW Time devoted to leisure and personal care \n",
"\n",
" MEASURE Measure INEQUALITY Inequality Unit Code \\\n",
"21 L Value TOT Total PC \n",
"130 L Value TOT Total PC \n",
"239 L Value TOT Total RATIO \n",
"348 L Value TOT Total USD \n",
"531 L Value TOT Total USD \n",
"640 L Value TOT Total PC \n",
"825 L Value TOT Total PC \n",
"936 L Value TOT Total PC \n",
"1121 L Value TOT Total USD \n",
"1306 L Value TOT Total PC \n",
"1473 L Value TOT Total PC \n",
"1584 L Value TOT Total AVSCORE \n",
"1769 L Value TOT Total YR \n",
"1880 L Value TOT Total MICRO_M3 \n",
"1989 L Value TOT Total PC \n",
"2100 L Value TOT Total AVSCORE \n",
"2209 L Value TOT Total PC \n",
"2394 L Value TOT Total YR \n",
"2505 L Value TOT Total PC \n",
"2690 L Value TOT Total AVSCORE \n",
"2869 L Value TOT Total PC \n",
"2980 L Value TOT Total RATIO \n",
"3091 L Value TOT Total PC \n",
"3202 L Value TOT Total HOUR \n",
"\n",
" Unit PowerCode Code PowerCode \\\n",
"21 Percentage 0 units \n",
"130 Percentage 0 units \n",
"239 Ratio 0 units \n",
"348 US Dollar 0 units \n",
"531 US Dollar 0 units \n",
"640 Percentage 0 units \n",
"825 Percentage 0 units \n",
"936 Percentage 0 units \n",
"1121 US Dollar 0 units \n",
"1306 Percentage 0 units \n",
"1473 Percentage 0 units \n",
"1584 Average score 0 units \n",
"1769 Years 0 units \n",
"1880 Micrograms per cubic metre 0 units \n",
"1989 Percentage 0 units \n",
"2100 Average score 0 units \n",
"2209 Percentage 0 units \n",
"2394 Years 0 units \n",
"2505 Percentage 0 units \n",
"2690 Average score 0 units \n",
"2869 Percentage 0 units \n",
"2980 Ratio 0 units \n",
"3091 Percentage 0 units \n",
"3202 Hours 0 units \n",
"\n",
" Reference Period Code Reference Period Value Flag Codes \\\n",
"21 NaN NaN 3.20 NaN \n",
"130 NaN NaN 21.00 E \n",
"239 NaN NaN 1.10 NaN \n",
"348 NaN NaN 17852.00 E \n",
"531 NaN NaN 10919.00 NaN \n",
"640 NaN NaN 60.00 NaN \n",
"825 NaN NaN 7.30 NaN \n",
"936 NaN NaN 3.77 NaN \n",
"1121 NaN NaN 22655.00 NaN \n",
"1306 NaN NaN 91.00 NaN \n",
"1473 NaN NaN 90.00 NaN \n",
"1584 NaN NaN 521.00 NaN \n",
"1769 NaN NaN 18.40 NaN \n",
"1880 NaN NaN 33.00 NaN \n",
"1989 NaN NaN 79.00 NaN \n",
"2100 NaN NaN 10.80 NaN \n",
"2209 NaN NaN 55.00 NaN \n",
"2394 NaN NaN 76.90 NaN \n",
"2505 NaN NaN 58.00 NaN \n",
"2690 NaN NaN 5.80 NaN \n",
"2869 NaN NaN 1.40 NaN \n",
"2980 NaN NaN 0.90 NaN \n",
"3091 NaN NaN 7.41 NaN \n",
"3202 NaN NaN 14.20 NaN \n",
"\n",
" Flags \n",
"21 NaN \n",
"130 Estimated value \n",
"239 NaN \n",
"348 Estimated value \n",
"531 NaN \n",
"640 NaN \n",
"825 NaN \n",
"936 NaN \n",
"1121 NaN \n",
"1306 NaN \n",
"1473 NaN \n",
"1584 NaN \n",
"1769 NaN \n",
"1880 NaN \n",
"1989 NaN \n",
"2100 NaN \n",
"2209 NaN \n",
"2394 NaN \n",
"2505 NaN \n",
"2690 NaN \n",
"2869 NaN \n",
"2980 NaN \n",
"3091 NaN \n",
"3202 NaN "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pol = oecd_bli[oecd_bli[\"Country\"]==\"Poland\"]\n",
"pol"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"We can use the `pivot` method to recast the data into a much easier to grasp format. The key point is that each country and INDICATOR determines a specific value. So let's have one row for each country with one column for each `INDICATOR`, and in that column we'll place the `VALUE` associated with that country and that indicator. It's as easy as this:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" Indicator | \n",
" Air pollution | \n",
" Assault rate | \n",
" Consultation on rule-making | \n",
" Dwellings without basic facilities | \n",
" Educational attainment | \n",
" Employees working very long hours | \n",
" Employment rate | \n",
" Homicide rate | \n",
" Household net adjusted disposable income | \n",
" Household net financial wealth | \n",
" ... | \n",
" Long-term unemployment rate | \n",
" Personal earnings | \n",
" Quality of support network | \n",
" Rooms per person | \n",
" Self-reported health | \n",
" Student skills | \n",
" Time devoted to leisure and personal care | \n",
" Voter turnout | \n",
" Water quality | \n",
" Years in education | \n",
"
\n",
" \n",
" Country | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Australia | \n",
" 13.0 | \n",
" 2.1 | \n",
" 10.5 | \n",
" 1.1 | \n",
" 76.0 | \n",
" 14.02 | \n",
" 72.0 | \n",
" 0.8 | \n",
" 31588.0 | \n",
" 47657.0 | \n",
" ... | \n",
" 1.08 | \n",
" 50449.0 | \n",
" 92.0 | \n",
" 2.3 | \n",
" 85.0 | \n",
" 512.0 | \n",
" 14.41 | \n",
" 93.0 | \n",
" 91.0 | \n",
" 19.4 | \n",
"
\n",
" \n",
" Austria | \n",
" 27.0 | \n",
" 3.4 | \n",
" 7.1 | \n",
" 1.0 | \n",
" 83.0 | \n",
" 7.61 | \n",
" 72.0 | \n",
" 0.4 | \n",
" 31173.0 | \n",
" 49887.0 | \n",
" ... | \n",
" 1.19 | \n",
" 45199.0 | \n",
" 89.0 | \n",
" 1.6 | \n",
" 69.0 | \n",
" 500.0 | \n",
" 14.46 | \n",
" 75.0 | \n",
" 94.0 | \n",
" 17.0 | \n",
"
\n",
" \n",
"
\n",
"
2 rows × 24 columns
\n",
"
"
],
"text/plain": [
"Indicator Air pollution Assault rate Consultation on rule-making \\\n",
"Country \n",
"Australia 13.0 2.1 10.5 \n",
"Austria 27.0 3.4 7.1 \n",
"\n",
"Indicator Dwellings without basic facilities Educational attainment \\\n",
"Country \n",
"Australia 1.1 76.0 \n",
"Austria 1.0 83.0 \n",
"\n",
"Indicator Employees working very long hours Employment rate Homicide rate \\\n",
"Country \n",
"Australia 14.02 72.0 0.8 \n",
"Austria 7.61 72.0 0.4 \n",
"\n",
"Indicator Household net adjusted disposable income \\\n",
"Country \n",
"Australia 31588.0 \n",
"Austria 31173.0 \n",
"\n",
"Indicator Household net financial wealth ... \\\n",
"Country ... \n",
"Australia 47657.0 ... \n",
"Austria 49887.0 ... \n",
"\n",
"Indicator Long-term unemployment rate Personal earnings \\\n",
"Country \n",
"Australia 1.08 50449.0 \n",
"Austria 1.19 45199.0 \n",
"\n",
"Indicator Quality of support network Rooms per person Self-reported health \\\n",
"Country \n",
"Australia 92.0 2.3 85.0 \n",
"Austria 89.0 1.6 69.0 \n",
"\n",
"Indicator Student skills Time devoted to leisure and personal care \\\n",
"Country \n",
"Australia 512.0 14.41 \n",
"Austria 500.0 14.46 \n",
"\n",
"Indicator Voter turnout Water quality Years in education \n",
"Country \n",
"Australia 93.0 91.0 19.4 \n",
"Austria 75.0 94.0 17.0 \n",
"\n",
"[2 rows x 24 columns]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"oecd_bli = oecd_bli.pivot(index=\"Country\", columns=\"Indicator\", values=\"Value\")\n",
"oecd_bli.head(2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"In the exercise ahead, we're going to take particular interest in the `Life satisfaction` score, a kind of general \"quality of life\" or \"happiness\" score computed from a formula combining many of the indicators in this data. "
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"Country\n",
"Australia 7.3\n",
"Austria 6.9\n",
"Belgium 6.9\n",
"Brazil 7.0\n",
"Canada 7.3\n",
"Name: Life satisfaction, dtype: float64"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"oecd_bli[\"Life satisfaction\"].head()"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"Notice when we print out the `Life satisfaction` column, the country name is also printed out. This is because the `Country` was defined as the index of the new table created when we used the `pivot` method. Think of the index column (or columns) as providing a unique name for each row."
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Load and prepare GDP per capita data"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"Elsewhere, on the world wide web, with help from Google, we find data about GDP (\"gross domestic product\")\n",
"[here](http://goo.gl/j1MSKe). Hit the download butten and place another csv file in the same\n",
"directory as the last data."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Subject Descriptor | \n",
" Units | \n",
" Scale | \n",
" Country/Series-specific Notes | \n",
" GDP per capita | \n",
" Estimates Start After | \n",
"
\n",
" \n",
" Country | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Afghanistan | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 599.994 | \n",
" 2013.0 | \n",
"
\n",
" \n",
" Albania | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 3995.383 | \n",
" 2010.0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Subject Descriptor Units \\\n",
"Country \n",
"Afghanistan Gross domestic product per capita, current prices U.S. dollars \n",
"Albania Gross domestic product per capita, current prices U.S. dollars \n",
"\n",
" Scale Country/Series-specific Notes \\\n",
"Country \n",
"Afghanistan Units See notes for: Gross domestic product, curren... \n",
"Albania Units See notes for: Gross domestic product, curren... \n",
"\n",
" GDP per capita Estimates Start After \n",
"Country \n",
"Afghanistan 599.994 2013.0 \n",
"Albania 3995.383 2010.0 "
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Download data from http://goo.gl/j1MSKe (=> imf.org)\n",
"gdp_per_capita = pd.read_csv(datapath+\"gdp_per_capita.csv\", thousands=',', delimiter='\\t',\n",
" encoding='latin1', na_values=\"n/a\")\n",
"gdp_per_capita.rename(columns={\"2015\": \"GDP per capita\"}, inplace=True)\n",
"# Make \"Country\" the index column. We are going to merge data on this column.\n",
"gdp_per_capita.set_index(\"Country\", inplace=True)\n",
"gdp_per_capita.head(2)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
" We now engage in the great magic, the single most important operation by which information is created, the `merge`.\n",
" We are going to take the quality of life data, which is indexed by country, and the GDP data, which is now also indexed\n",
" by country, and merge rows, producing one large table which contains all the rows and columns of the `oecd_bli` table,\n",
" as well as a new `GDP per Capita` column."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true,
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Air pollution | \n",
" Assault rate | \n",
" Consultation on rule-making | \n",
" Dwellings without basic facilities | \n",
" Educational attainment | \n",
" Employees working very long hours | \n",
" Employment rate | \n",
" Homicide rate | \n",
" Household net adjusted disposable income | \n",
" Household net financial wealth | \n",
" ... | \n",
" Time devoted to leisure and personal care | \n",
" Voter turnout | \n",
" Water quality | \n",
" Years in education | \n",
" Subject Descriptor | \n",
" Units | \n",
" Scale | \n",
" Country/Series-specific Notes | \n",
" GDP per capita | \n",
" Estimates Start After | \n",
"
\n",
" \n",
" Country | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Brazil | \n",
" 18.0 | \n",
" 7.9 | \n",
" 4.0 | \n",
" 6.7 | \n",
" 45.0 | \n",
" 10.41 | \n",
" 67.0 | \n",
" 25.5 | \n",
" 11664.0 | \n",
" 6844.0 | \n",
" ... | \n",
" 14.97 | \n",
" 79.0 | \n",
" 72.0 | \n",
" 16.3 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 8669.998 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Mexico | \n",
" 30.0 | \n",
" 12.8 | \n",
" 9.0 | \n",
" 4.2 | \n",
" 37.0 | \n",
" 28.83 | \n",
" 61.0 | \n",
" 23.4 | \n",
" 13085.0 | \n",
" 9056.0 | \n",
" ... | \n",
" 13.89 | \n",
" 63.0 | \n",
" 67.0 | \n",
" 14.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 9009.280 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Russia | \n",
" 15.0 | \n",
" 3.8 | \n",
" 2.5 | \n",
" 15.1 | \n",
" 94.0 | \n",
" 0.16 | \n",
" 69.0 | \n",
" 12.8 | \n",
" 19292.0 | \n",
" 3412.0 | \n",
" ... | \n",
" 14.97 | \n",
" 65.0 | \n",
" 56.0 | \n",
" 16.0 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 9054.914 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Turkey | \n",
" 35.0 | \n",
" 5.0 | \n",
" 5.5 | \n",
" 12.7 | \n",
" 34.0 | \n",
" 40.86 | \n",
" 50.0 | \n",
" 1.2 | \n",
" 14095.0 | \n",
" 3251.0 | \n",
" ... | \n",
" 13.42 | \n",
" 88.0 | \n",
" 62.0 | \n",
" 16.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 9437.372 | \n",
" 2013.0 | \n",
"
\n",
" \n",
" Hungary | \n",
" 15.0 | \n",
" 3.6 | \n",
" 7.9 | \n",
" 4.8 | \n",
" 82.0 | \n",
" 3.19 | \n",
" 58.0 | \n",
" 1.3 | \n",
" 15442.0 | \n",
" 13277.0 | \n",
" ... | \n",
" 15.04 | \n",
" 62.0 | \n",
" 77.0 | \n",
" 17.6 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 12239.894 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Poland | \n",
" 33.0 | \n",
" 1.4 | \n",
" 10.8 | \n",
" 3.2 | \n",
" 90.0 | \n",
" 7.41 | \n",
" 60.0 | \n",
" 0.9 | \n",
" 17852.0 | \n",
" 10919.0 | \n",
" ... | \n",
" 14.20 | \n",
" 55.0 | \n",
" 79.0 | \n",
" 18.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 12495.334 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Chile | \n",
" 46.0 | \n",
" 6.9 | \n",
" 2.0 | \n",
" 9.4 | \n",
" 57.0 | \n",
" 15.42 | \n",
" 62.0 | \n",
" 4.4 | \n",
" 14533.0 | \n",
" 17733.0 | \n",
" ... | \n",
" 14.41 | \n",
" 49.0 | \n",
" 73.0 | \n",
" 16.5 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 13340.905 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Slovak Republic | \n",
" 13.0 | \n",
" 3.0 | \n",
" 6.6 | \n",
" 0.6 | \n",
" 92.0 | \n",
" 7.02 | \n",
" 60.0 | \n",
" 1.2 | \n",
" 17503.0 | \n",
" 8663.0 | \n",
" ... | \n",
" 14.99 | \n",
" 59.0 | \n",
" 81.0 | \n",
" 16.3 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 15991.736 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Czech Republic | \n",
" 16.0 | \n",
" 2.8 | \n",
" 6.8 | \n",
" 0.9 | \n",
" 92.0 | \n",
" 6.98 | \n",
" 68.0 | \n",
" 0.8 | \n",
" 18404.0 | \n",
" 17299.0 | \n",
" ... | \n",
" 14.98 | \n",
" 59.0 | \n",
" 85.0 | \n",
" 18.1 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 17256.918 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Estonia | \n",
" 9.0 | \n",
" 5.5 | \n",
" 3.3 | \n",
" 8.1 | \n",
" 90.0 | \n",
" 3.30 | \n",
" 68.0 | \n",
" 4.8 | \n",
" 15167.0 | \n",
" 7680.0 | \n",
" ... | \n",
" 14.90 | \n",
" 64.0 | \n",
" 79.0 | \n",
" 17.5 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 17288.083 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Greece | \n",
" 27.0 | \n",
" 3.7 | \n",
" 6.5 | \n",
" 0.7 | \n",
" 68.0 | \n",
" 6.16 | \n",
" 49.0 | \n",
" 1.6 | \n",
" 18575.0 | \n",
" 14579.0 | \n",
" ... | \n",
" 14.91 | \n",
" 64.0 | \n",
" 69.0 | \n",
" 18.6 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 18064.288 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Portugal | \n",
" 18.0 | \n",
" 5.7 | \n",
" 6.5 | \n",
" 0.9 | \n",
" 38.0 | \n",
" 9.62 | \n",
" 61.0 | \n",
" 1.1 | \n",
" 20086.0 | \n",
" 31245.0 | \n",
" ... | \n",
" 14.95 | \n",
" 58.0 | \n",
" 86.0 | \n",
" 17.6 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 19121.592 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Slovenia | \n",
" 26.0 | \n",
" 3.9 | \n",
" 10.3 | \n",
" 0.5 | \n",
" 85.0 | \n",
" 5.63 | \n",
" 63.0 | \n",
" 0.4 | \n",
" 19326.0 | \n",
" 18465.0 | \n",
" ... | \n",
" 14.62 | \n",
" 52.0 | \n",
" 88.0 | \n",
" 18.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 20732.482 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Spain | \n",
" 24.0 | \n",
" 4.2 | \n",
" 7.3 | \n",
" 0.1 | \n",
" 55.0 | \n",
" 5.89 | \n",
" 56.0 | \n",
" 0.6 | \n",
" 22477.0 | \n",
" 24774.0 | \n",
" ... | \n",
" 16.06 | \n",
" 69.0 | \n",
" 71.0 | \n",
" 17.6 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 25864.721 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Korea | \n",
" 30.0 | \n",
" 2.1 | \n",
" 10.4 | \n",
" 4.2 | \n",
" 82.0 | \n",
" 18.72 | \n",
" 64.0 | \n",
" 1.1 | \n",
" 19510.0 | \n",
" 29091.0 | \n",
" ... | \n",
" 14.63 | \n",
" 76.0 | \n",
" 78.0 | \n",
" 17.5 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 27195.197 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Italy | \n",
" 21.0 | \n",
" 4.7 | \n",
" 5.0 | \n",
" 1.1 | \n",
" 57.0 | \n",
" 3.66 | \n",
" 56.0 | \n",
" 0.7 | \n",
" 25166.0 | \n",
" 54987.0 | \n",
" ... | \n",
" 14.98 | \n",
" 75.0 | \n",
" 71.0 | \n",
" 16.8 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 29866.581 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Japan | \n",
" 24.0 | \n",
" 1.4 | \n",
" 7.3 | \n",
" 6.4 | \n",
" 94.0 | \n",
" 22.26 | \n",
" 72.0 | \n",
" 0.3 | \n",
" 26111.0 | \n",
" 86764.0 | \n",
" ... | \n",
" 14.93 | \n",
" 53.0 | \n",
" 85.0 | \n",
" 16.3 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 32485.545 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Israel | \n",
" 21.0 | \n",
" 6.4 | \n",
" 2.5 | \n",
" 3.7 | \n",
" 85.0 | \n",
" 16.03 | \n",
" 67.0 | \n",
" 2.3 | \n",
" 22104.0 | \n",
" 52933.0 | \n",
" ... | \n",
" 14.48 | \n",
" 68.0 | \n",
" 68.0 | \n",
" 15.8 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 35343.336 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" New Zealand | \n",
" 11.0 | \n",
" 2.2 | \n",
" 10.3 | \n",
" 0.2 | \n",
" 74.0 | \n",
" 13.87 | \n",
" 73.0 | \n",
" 1.2 | \n",
" 23815.0 | \n",
" 28290.0 | \n",
" ... | \n",
" 14.87 | \n",
" 77.0 | \n",
" 89.0 | \n",
" 18.1 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 37044.891 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" France | \n",
" 12.0 | \n",
" 5.0 | \n",
" 3.5 | \n",
" 0.5 | \n",
" 73.0 | \n",
" 8.15 | \n",
" 64.0 | \n",
" 0.6 | \n",
" 28799.0 | \n",
" 48741.0 | \n",
" ... | \n",
" 15.33 | \n",
" 80.0 | \n",
" 82.0 | \n",
" 16.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 37675.006 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Belgium | \n",
" 21.0 | \n",
" 6.6 | \n",
" 4.5 | \n",
" 2.0 | \n",
" 72.0 | \n",
" 4.57 | \n",
" 62.0 | \n",
" 1.1 | \n",
" 28307.0 | \n",
" 83876.0 | \n",
" ... | \n",
" 15.71 | \n",
" 89.0 | \n",
" 87.0 | \n",
" 18.9 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 40106.632 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Germany | \n",
" 16.0 | \n",
" 3.6 | \n",
" 4.5 | \n",
" 0.1 | \n",
" 86.0 | \n",
" 5.25 | \n",
" 73.0 | \n",
" 0.5 | \n",
" 31252.0 | \n",
" 50394.0 | \n",
" ... | \n",
" 15.31 | \n",
" 72.0 | \n",
" 95.0 | \n",
" 18.2 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 40996.511 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Finland | \n",
" 15.0 | \n",
" 2.4 | \n",
" 9.0 | \n",
" 0.6 | \n",
" 85.0 | \n",
" 3.58 | \n",
" 69.0 | \n",
" 1.4 | \n",
" 27927.0 | \n",
" 18761.0 | \n",
" ... | \n",
" 14.89 | \n",
" 69.0 | \n",
" 94.0 | \n",
" 19.7 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 41973.988 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Canada | \n",
" 15.0 | \n",
" 1.3 | \n",
" 10.5 | \n",
" 0.2 | \n",
" 89.0 | \n",
" 3.94 | \n",
" 72.0 | \n",
" 1.5 | \n",
" 29365.0 | \n",
" 67913.0 | \n",
" ... | \n",
" 14.25 | \n",
" 61.0 | \n",
" 91.0 | \n",
" 17.2 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 43331.961 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Netherlands | \n",
" 30.0 | \n",
" 4.9 | \n",
" 6.1 | \n",
" 0.0 | \n",
" 73.0 | \n",
" 0.45 | \n",
" 74.0 | \n",
" 0.9 | \n",
" 27888.0 | \n",
" 77961.0 | \n",
" ... | \n",
" 15.44 | \n",
" 75.0 | \n",
" 92.0 | \n",
" 18.7 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 43603.115 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Austria | \n",
" 27.0 | \n",
" 3.4 | \n",
" 7.1 | \n",
" 1.0 | \n",
" 83.0 | \n",
" 7.61 | \n",
" 72.0 | \n",
" 0.4 | \n",
" 31173.0 | \n",
" 49887.0 | \n",
" ... | \n",
" 14.46 | \n",
" 75.0 | \n",
" 94.0 | \n",
" 17.0 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 43724.031 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" United Kingdom | \n",
" 13.0 | \n",
" 1.9 | \n",
" 11.5 | \n",
" 0.2 | \n",
" 78.0 | \n",
" 12.70 | \n",
" 71.0 | \n",
" 0.3 | \n",
" 27029.0 | \n",
" 60778.0 | \n",
" ... | \n",
" 14.83 | \n",
" 66.0 | \n",
" 88.0 | \n",
" 16.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 43770.688 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Sweden | \n",
" 10.0 | \n",
" 5.1 | \n",
" 10.9 | \n",
" 0.0 | \n",
" 88.0 | \n",
" 1.13 | \n",
" 74.0 | \n",
" 0.7 | \n",
" 29185.0 | \n",
" 60328.0 | \n",
" ... | \n",
" 15.11 | \n",
" 86.0 | \n",
" 95.0 | \n",
" 19.3 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 49866.266 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Iceland | \n",
" 18.0 | \n",
" 2.7 | \n",
" 5.1 | \n",
" 0.4 | \n",
" 71.0 | \n",
" 12.25 | \n",
" 82.0 | \n",
" 0.3 | \n",
" 23965.0 | \n",
" 43045.0 | \n",
" ... | \n",
" 14.61 | \n",
" 81.0 | \n",
" 97.0 | \n",
" 19.8 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 50854.583 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Australia | \n",
" 13.0 | \n",
" 2.1 | \n",
" 10.5 | \n",
" 1.1 | \n",
" 76.0 | \n",
" 14.02 | \n",
" 72.0 | \n",
" 0.8 | \n",
" 31588.0 | \n",
" 47657.0 | \n",
" ... | \n",
" 14.41 | \n",
" 93.0 | \n",
" 91.0 | \n",
" 19.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 50961.865 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Ireland | \n",
" 13.0 | \n",
" 2.6 | \n",
" 9.0 | \n",
" 0.2 | \n",
" 75.0 | \n",
" 4.20 | \n",
" 60.0 | \n",
" 0.8 | \n",
" 23917.0 | \n",
" 31580.0 | \n",
" ... | \n",
" 15.19 | \n",
" 70.0 | \n",
" 80.0 | \n",
" 17.6 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 51350.744 | \n",
" 2014.0 | \n",
"
\n",
" \n",
" Denmark | \n",
" 15.0 | \n",
" 3.9 | \n",
" 7.0 | \n",
" 0.9 | \n",
" 78.0 | \n",
" 2.03 | \n",
" 73.0 | \n",
" 0.3 | \n",
" 26491.0 | \n",
" 44488.0 | \n",
" ... | \n",
" 16.06 | \n",
" 88.0 | \n",
" 94.0 | \n",
" 19.4 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 52114.165 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" United States | \n",
" 18.0 | \n",
" 1.5 | \n",
" 8.3 | \n",
" 0.1 | \n",
" 89.0 | \n",
" 11.30 | \n",
" 67.0 | \n",
" 5.2 | \n",
" 41355.0 | \n",
" 145769.0 | \n",
" ... | \n",
" 14.27 | \n",
" 68.0 | \n",
" 85.0 | \n",
" 17.2 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 55805.204 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Norway | \n",
" 16.0 | \n",
" 3.3 | \n",
" 8.1 | \n",
" 0.3 | \n",
" 82.0 | \n",
" 2.82 | \n",
" 75.0 | \n",
" 0.6 | \n",
" 33492.0 | \n",
" 8797.0 | \n",
" ... | \n",
" 15.56 | \n",
" 78.0 | \n",
" 94.0 | \n",
" 17.9 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 74822.106 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Switzerland | \n",
" 20.0 | \n",
" 4.2 | \n",
" 8.4 | \n",
" 0.0 | \n",
" 86.0 | \n",
" 6.72 | \n",
" 80.0 | \n",
" 0.5 | \n",
" 33491.0 | \n",
" 108823.0 | \n",
" ... | \n",
" 14.98 | \n",
" 49.0 | \n",
" 96.0 | \n",
" 17.3 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 80675.308 | \n",
" 2015.0 | \n",
"
\n",
" \n",
" Luxembourg | \n",
" 12.0 | \n",
" 4.3 | \n",
" 6.0 | \n",
" 0.1 | \n",
" 78.0 | \n",
" 3.47 | \n",
" 66.0 | \n",
" 0.4 | \n",
" 38951.0 | \n",
" 61765.0 | \n",
" ... | \n",
" 15.12 | \n",
" 91.0 | \n",
" 86.0 | \n",
" 15.1 | \n",
" Gross domestic product per capita, current prices | \n",
" U.S. dollars | \n",
" Units | \n",
" See notes for: Gross domestic product, curren... | \n",
" 101994.093 | \n",
" 2014.0 | \n",
"
\n",
" \n",
"
\n",
"
36 rows × 30 columns
\n",
"
"
],
"text/plain": [
" Air pollution Assault rate Consultation on rule-making \\\n",
"Country \n",
"Brazil 18.0 7.9 4.0 \n",
"Mexico 30.0 12.8 9.0 \n",
"Russia 15.0 3.8 2.5 \n",
"Turkey 35.0 5.0 5.5 \n",
"Hungary 15.0 3.6 7.9 \n",
"Poland 33.0 1.4 10.8 \n",
"Chile 46.0 6.9 2.0 \n",
"Slovak Republic 13.0 3.0 6.6 \n",
"Czech Republic 16.0 2.8 6.8 \n",
"Estonia 9.0 5.5 3.3 \n",
"Greece 27.0 3.7 6.5 \n",
"Portugal 18.0 5.7 6.5 \n",
"Slovenia 26.0 3.9 10.3 \n",
"Spain 24.0 4.2 7.3 \n",
"Korea 30.0 2.1 10.4 \n",
"Italy 21.0 4.7 5.0 \n",
"Japan 24.0 1.4 7.3 \n",
"Israel 21.0 6.4 2.5 \n",
"New Zealand 11.0 2.2 10.3 \n",
"France 12.0 5.0 3.5 \n",
"Belgium 21.0 6.6 4.5 \n",
"Germany 16.0 3.6 4.5 \n",
"Finland 15.0 2.4 9.0 \n",
"Canada 15.0 1.3 10.5 \n",
"Netherlands 30.0 4.9 6.1 \n",
"Austria 27.0 3.4 7.1 \n",
"United Kingdom 13.0 1.9 11.5 \n",
"Sweden 10.0 5.1 10.9 \n",
"Iceland 18.0 2.7 5.1 \n",
"Australia 13.0 2.1 10.5 \n",
"Ireland 13.0 2.6 9.0 \n",
"Denmark 15.0 3.9 7.0 \n",
"United States 18.0 1.5 8.3 \n",
"Norway 16.0 3.3 8.1 \n",
"Switzerland 20.0 4.2 8.4 \n",
"Luxembourg 12.0 4.3 6.0 \n",
"\n",
" Dwellings without basic facilities Educational attainment \\\n",
"Country \n",
"Brazil 6.7 45.0 \n",
"Mexico 4.2 37.0 \n",
"Russia 15.1 94.0 \n",
"Turkey 12.7 34.0 \n",
"Hungary 4.8 82.0 \n",
"Poland 3.2 90.0 \n",
"Chile 9.4 57.0 \n",
"Slovak Republic 0.6 92.0 \n",
"Czech Republic 0.9 92.0 \n",
"Estonia 8.1 90.0 \n",
"Greece 0.7 68.0 \n",
"Portugal 0.9 38.0 \n",
"Slovenia 0.5 85.0 \n",
"Spain 0.1 55.0 \n",
"Korea 4.2 82.0 \n",
"Italy 1.1 57.0 \n",
"Japan 6.4 94.0 \n",
"Israel 3.7 85.0 \n",
"New Zealand 0.2 74.0 \n",
"France 0.5 73.0 \n",
"Belgium 2.0 72.0 \n",
"Germany 0.1 86.0 \n",
"Finland 0.6 85.0 \n",
"Canada 0.2 89.0 \n",
"Netherlands 0.0 73.0 \n",
"Austria 1.0 83.0 \n",
"United Kingdom 0.2 78.0 \n",
"Sweden 0.0 88.0 \n",
"Iceland 0.4 71.0 \n",
"Australia 1.1 76.0 \n",
"Ireland 0.2 75.0 \n",
"Denmark 0.9 78.0 \n",
"United States 0.1 89.0 \n",
"Norway 0.3 82.0 \n",
"Switzerland 0.0 86.0 \n",
"Luxembourg 0.1 78.0 \n",
"\n",
" Employees working very long hours Employment rate \\\n",
"Country \n",
"Brazil 10.41 67.0 \n",
"Mexico 28.83 61.0 \n",
"Russia 0.16 69.0 \n",
"Turkey 40.86 50.0 \n",
"Hungary 3.19 58.0 \n",
"Poland 7.41 60.0 \n",
"Chile 15.42 62.0 \n",
"Slovak Republic 7.02 60.0 \n",
"Czech Republic 6.98 68.0 \n",
"Estonia 3.30 68.0 \n",
"Greece 6.16 49.0 \n",
"Portugal 9.62 61.0 \n",
"Slovenia 5.63 63.0 \n",
"Spain 5.89 56.0 \n",
"Korea 18.72 64.0 \n",
"Italy 3.66 56.0 \n",
"Japan 22.26 72.0 \n",
"Israel 16.03 67.0 \n",
"New Zealand 13.87 73.0 \n",
"France 8.15 64.0 \n",
"Belgium 4.57 62.0 \n",
"Germany 5.25 73.0 \n",
"Finland 3.58 69.0 \n",
"Canada 3.94 72.0 \n",
"Netherlands 0.45 74.0 \n",
"Austria 7.61 72.0 \n",
"United Kingdom 12.70 71.0 \n",
"Sweden 1.13 74.0 \n",
"Iceland 12.25 82.0 \n",
"Australia 14.02 72.0 \n",
"Ireland 4.20 60.0 \n",
"Denmark 2.03 73.0 \n",
"United States 11.30 67.0 \n",
"Norway 2.82 75.0 \n",
"Switzerland 6.72 80.0 \n",
"Luxembourg 3.47 66.0 \n",
"\n",
" Homicide rate Household net adjusted disposable income \\\n",
"Country \n",
"Brazil 25.5 11664.0 \n",
"Mexico 23.4 13085.0 \n",
"Russia 12.8 19292.0 \n",
"Turkey 1.2 14095.0 \n",
"Hungary 1.3 15442.0 \n",
"Poland 0.9 17852.0 \n",
"Chile 4.4 14533.0 \n",
"Slovak Republic 1.2 17503.0 \n",
"Czech Republic 0.8 18404.0 \n",
"Estonia 4.8 15167.0 \n",
"Greece 1.6 18575.0 \n",
"Portugal 1.1 20086.0 \n",
"Slovenia 0.4 19326.0 \n",
"Spain 0.6 22477.0 \n",
"Korea 1.1 19510.0 \n",
"Italy 0.7 25166.0 \n",
"Japan 0.3 26111.0 \n",
"Israel 2.3 22104.0 \n",
"New Zealand 1.2 23815.0 \n",
"France 0.6 28799.0 \n",
"Belgium 1.1 28307.0 \n",
"Germany 0.5 31252.0 \n",
"Finland 1.4 27927.0 \n",
"Canada 1.5 29365.0 \n",
"Netherlands 0.9 27888.0 \n",
"Austria 0.4 31173.0 \n",
"United Kingdom 0.3 27029.0 \n",
"Sweden 0.7 29185.0 \n",
"Iceland 0.3 23965.0 \n",
"Australia 0.8 31588.0 \n",
"Ireland 0.8 23917.0 \n",
"Denmark 0.3 26491.0 \n",
"United States 5.2 41355.0 \n",
"Norway 0.6 33492.0 \n",
"Switzerland 0.5 33491.0 \n",
"Luxembourg 0.4 38951.0 \n",
"\n",
" Household net financial wealth ... \\\n",
"Country ... \n",
"Brazil 6844.0 ... \n",
"Mexico 9056.0 ... \n",
"Russia 3412.0 ... \n",
"Turkey 3251.0 ... \n",
"Hungary 13277.0 ... \n",
"Poland 10919.0 ... \n",
"Chile 17733.0 ... \n",
"Slovak Republic 8663.0 ... \n",
"Czech Republic 17299.0 ... \n",
"Estonia 7680.0 ... \n",
"Greece 14579.0 ... \n",
"Portugal 31245.0 ... \n",
"Slovenia 18465.0 ... \n",
"Spain 24774.0 ... \n",
"Korea 29091.0 ... \n",
"Italy 54987.0 ... \n",
"Japan 86764.0 ... \n",
"Israel 52933.0 ... \n",
"New Zealand 28290.0 ... \n",
"France 48741.0 ... \n",
"Belgium 83876.0 ... \n",
"Germany 50394.0 ... \n",
"Finland 18761.0 ... \n",
"Canada 67913.0 ... \n",
"Netherlands 77961.0 ... \n",
"Austria 49887.0 ... \n",
"United Kingdom 60778.0 ... \n",
"Sweden 60328.0 ... \n",
"Iceland 43045.0 ... \n",
"Australia 47657.0 ... \n",
"Ireland 31580.0 ... \n",
"Denmark 44488.0 ... \n",
"United States 145769.0 ... \n",
"Norway 8797.0 ... \n",
"Switzerland 108823.0 ... \n",
"Luxembourg 61765.0 ... \n",
"\n",
" Time devoted to leisure and personal care Voter turnout \\\n",
"Country \n",
"Brazil 14.97 79.0 \n",
"Mexico 13.89 63.0 \n",
"Russia 14.97 65.0 \n",
"Turkey 13.42 88.0 \n",
"Hungary 15.04 62.0 \n",
"Poland 14.20 55.0 \n",
"Chile 14.41 49.0 \n",
"Slovak Republic 14.99 59.0 \n",
"Czech Republic 14.98 59.0 \n",
"Estonia 14.90 64.0 \n",
"Greece 14.91 64.0 \n",
"Portugal 14.95 58.0 \n",
"Slovenia 14.62 52.0 \n",
"Spain 16.06 69.0 \n",
"Korea 14.63 76.0 \n",
"Italy 14.98 75.0 \n",
"Japan 14.93 53.0 \n",
"Israel 14.48 68.0 \n",
"New Zealand 14.87 77.0 \n",
"France 15.33 80.0 \n",
"Belgium 15.71 89.0 \n",
"Germany 15.31 72.0 \n",
"Finland 14.89 69.0 \n",
"Canada 14.25 61.0 \n",
"Netherlands 15.44 75.0 \n",
"Austria 14.46 75.0 \n",
"United Kingdom 14.83 66.0 \n",
"Sweden 15.11 86.0 \n",
"Iceland 14.61 81.0 \n",
"Australia 14.41 93.0 \n",
"Ireland 15.19 70.0 \n",
"Denmark 16.06 88.0 \n",
"United States 14.27 68.0 \n",
"Norway 15.56 78.0 \n",
"Switzerland 14.98 49.0 \n",
"Luxembourg 15.12 91.0 \n",
"\n",
" Water quality Years in education \\\n",
"Country \n",
"Brazil 72.0 16.3 \n",
"Mexico 67.0 14.4 \n",
"Russia 56.0 16.0 \n",
"Turkey 62.0 16.4 \n",
"Hungary 77.0 17.6 \n",
"Poland 79.0 18.4 \n",
"Chile 73.0 16.5 \n",
"Slovak Republic 81.0 16.3 \n",
"Czech Republic 85.0 18.1 \n",
"Estonia 79.0 17.5 \n",
"Greece 69.0 18.6 \n",
"Portugal 86.0 17.6 \n",
"Slovenia 88.0 18.4 \n",
"Spain 71.0 17.6 \n",
"Korea 78.0 17.5 \n",
"Italy 71.0 16.8 \n",
"Japan 85.0 16.3 \n",
"Israel 68.0 15.8 \n",
"New Zealand 89.0 18.1 \n",
"France 82.0 16.4 \n",
"Belgium 87.0 18.9 \n",
"Germany 95.0 18.2 \n",
"Finland 94.0 19.7 \n",
"Canada 91.0 17.2 \n",
"Netherlands 92.0 18.7 \n",
"Austria 94.0 17.0 \n",
"United Kingdom 88.0 16.4 \n",
"Sweden 95.0 19.3 \n",
"Iceland 97.0 19.8 \n",
"Australia 91.0 19.4 \n",
"Ireland 80.0 17.6 \n",
"Denmark 94.0 19.4 \n",
"United States 85.0 17.2 \n",
"Norway 94.0 17.9 \n",
"Switzerland 96.0 17.3 \n",
"Luxembourg 86.0 15.1 \n",
"\n",
" Subject Descriptor \\\n",
"Country \n",
"Brazil Gross domestic product per capita, current prices \n",
"Mexico Gross domestic product per capita, current prices \n",
"Russia Gross domestic product per capita, current prices \n",
"Turkey Gross domestic product per capita, current prices \n",
"Hungary Gross domestic product per capita, current prices \n",
"Poland Gross domestic product per capita, current prices \n",
"Chile Gross domestic product per capita, current prices \n",
"Slovak Republic Gross domestic product per capita, current prices \n",
"Czech Republic Gross domestic product per capita, current prices \n",
"Estonia Gross domestic product per capita, current prices \n",
"Greece Gross domestic product per capita, current prices \n",
"Portugal Gross domestic product per capita, current prices \n",
"Slovenia Gross domestic product per capita, current prices \n",
"Spain Gross domestic product per capita, current prices \n",
"Korea Gross domestic product per capita, current prices \n",
"Italy Gross domestic product per capita, current prices \n",
"Japan Gross domestic product per capita, current prices \n",
"Israel Gross domestic product per capita, current prices \n",
"New Zealand Gross domestic product per capita, current prices \n",
"France Gross domestic product per capita, current prices \n",
"Belgium Gross domestic product per capita, current prices \n",
"Germany Gross domestic product per capita, current prices \n",
"Finland Gross domestic product per capita, current prices \n",
"Canada Gross domestic product per capita, current prices \n",
"Netherlands Gross domestic product per capita, current prices \n",
"Austria Gross domestic product per capita, current prices \n",
"United Kingdom Gross domestic product per capita, current prices \n",
"Sweden Gross domestic product per capita, current prices \n",
"Iceland Gross domestic product per capita, current prices \n",
"Australia Gross domestic product per capita, current prices \n",
"Ireland Gross domestic product per capita, current prices \n",
"Denmark Gross domestic product per capita, current prices \n",
"United States Gross domestic product per capita, current prices \n",
"Norway Gross domestic product per capita, current prices \n",
"Switzerland Gross domestic product per capita, current prices \n",
"Luxembourg Gross domestic product per capita, current prices \n",
"\n",
" Units Scale \\\n",
"Country \n",
"Brazil U.S. dollars Units \n",
"Mexico U.S. dollars Units \n",
"Russia U.S. dollars Units \n",
"Turkey U.S. dollars Units \n",
"Hungary U.S. dollars Units \n",
"Poland U.S. dollars Units \n",
"Chile U.S. dollars Units \n",
"Slovak Republic U.S. dollars Units \n",
"Czech Republic U.S. dollars Units \n",
"Estonia U.S. dollars Units \n",
"Greece U.S. dollars Units \n",
"Portugal U.S. dollars Units \n",
"Slovenia U.S. dollars Units \n",
"Spain U.S. dollars Units \n",
"Korea U.S. dollars Units \n",
"Italy U.S. dollars Units \n",
"Japan U.S. dollars Units \n",
"Israel U.S. dollars Units \n",
"New Zealand U.S. dollars Units \n",
"France U.S. dollars Units \n",
"Belgium U.S. dollars Units \n",
"Germany U.S. dollars Units \n",
"Finland U.S. dollars Units \n",
"Canada U.S. dollars Units \n",
"Netherlands U.S. dollars Units \n",
"Austria U.S. dollars Units \n",
"United Kingdom U.S. dollars Units \n",
"Sweden U.S. dollars Units \n",
"Iceland U.S. dollars Units \n",
"Australia U.S. dollars Units \n",
"Ireland U.S. dollars Units \n",
"Denmark U.S. dollars Units \n",
"United States U.S. dollars Units \n",
"Norway U.S. dollars Units \n",
"Switzerland U.S. dollars Units \n",
"Luxembourg U.S. dollars Units \n",
"\n",
" Country/Series-specific Notes \\\n",
"Country \n",
"Brazil See notes for: Gross domestic product, curren... \n",
"Mexico See notes for: Gross domestic product, curren... \n",
"Russia See notes for: Gross domestic product, curren... \n",
"Turkey See notes for: Gross domestic product, curren... \n",
"Hungary See notes for: Gross domestic product, curren... \n",
"Poland See notes for: Gross domestic product, curren... \n",
"Chile See notes for: Gross domestic product, curren... \n",
"Slovak Republic See notes for: Gross domestic product, curren... \n",
"Czech Republic See notes for: Gross domestic product, curren... \n",
"Estonia See notes for: Gross domestic product, curren... \n",
"Greece See notes for: Gross domestic product, curren... \n",
"Portugal See notes for: Gross domestic product, curren... \n",
"Slovenia See notes for: Gross domestic product, curren... \n",
"Spain See notes for: Gross domestic product, curren... \n",
"Korea See notes for: Gross domestic product, curren... \n",
"Italy See notes for: Gross domestic product, curren... \n",
"Japan See notes for: Gross domestic product, curren... \n",
"Israel See notes for: Gross domestic product, curren... \n",
"New Zealand See notes for: Gross domestic product, curren... \n",
"France See notes for: Gross domestic product, curren... \n",
"Belgium See notes for: Gross domestic product, curren... \n",
"Germany See notes for: Gross domestic product, curren... \n",
"Finland See notes for: Gross domestic product, curren... \n",
"Canada See notes for: Gross domestic product, curren... \n",
"Netherlands See notes for: Gross domestic product, curren... \n",
"Austria See notes for: Gross domestic product, curren... \n",
"United Kingdom See notes for: Gross domestic product, curren... \n",
"Sweden See notes for: Gross domestic product, curren... \n",
"Iceland See notes for: Gross domestic product, curren... \n",
"Australia See notes for: Gross domestic product, curren... \n",
"Ireland See notes for: Gross domestic product, curren... \n",
"Denmark See notes for: Gross domestic product, curren... \n",
"United States See notes for: Gross domestic product, curren... \n",
"Norway See notes for: Gross domestic product, curren... \n",
"Switzerland See notes for: Gross domestic product, curren... \n",
"Luxembourg See notes for: Gross domestic product, curren... \n",
"\n",
" GDP per capita Estimates Start After \n",
"Country \n",
"Brazil 8669.998 2014.0 \n",
"Mexico 9009.280 2015.0 \n",
"Russia 9054.914 2015.0 \n",
"Turkey 9437.372 2013.0 \n",
"Hungary 12239.894 2015.0 \n",
"Poland 12495.334 2014.0 \n",
"Chile 13340.905 2014.0 \n",
"Slovak Republic 15991.736 2015.0 \n",
"Czech Republic 17256.918 2015.0 \n",
"Estonia 17288.083 2014.0 \n",
"Greece 18064.288 2014.0 \n",
"Portugal 19121.592 2014.0 \n",
"Slovenia 20732.482 2015.0 \n",
"Spain 25864.721 2014.0 \n",
"Korea 27195.197 2014.0 \n",
"Italy 29866.581 2015.0 \n",
"Japan 32485.545 2015.0 \n",
"Israel 35343.336 2015.0 \n",
"New Zealand 37044.891 2015.0 \n",
"France 37675.006 2015.0 \n",
"Belgium 40106.632 2014.0 \n",
"Germany 40996.511 2014.0 \n",
"Finland 41973.988 2014.0 \n",
"Canada 43331.961 2015.0 \n",
"Netherlands 43603.115 2014.0 \n",
"Austria 43724.031 2015.0 \n",
"United Kingdom 43770.688 2015.0 \n",
"Sweden 49866.266 2014.0 \n",
"Iceland 50854.583 2014.0 \n",
"Australia 50961.865 2014.0 \n",
"Ireland 51350.744 2014.0 \n",
"Denmark 52114.165 2015.0 \n",
"United States 55805.204 2015.0 \n",
"Norway 74822.106 2015.0 \n",
"Switzerland 80675.308 2015.0 \n",
"Luxembourg 101994.093 2014.0 \n",
"\n",
"[36 rows x 30 columns]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"full_country_stats = pd.merge(left=oecd_bli, right=gdp_per_capita, left_index=True, right_index=True)\n",
"full_country_stats.sort_values(by=\"GDP per capita\", inplace=\"True\")\n",
"full_country_stats"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"GDP per capita 55805.204\n",
"Life satisfaction 7.200\n",
"Name: United States, dtype: float64"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"full_country_stats[[\"GDP per capita\", 'Life satisfaction']].loc[\"United States\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.13"
},
"nav_menu": {},
"toc": {
"colors": {
"hover_highlight": "#DAA520",
"running_highlight": "#FF0000",
"selected_highlight": "#FFD700"
},
"moveMenuLeft": true,
"nav_menu": {
"height": "81px",
"width": "252px"
},
"navigate_menu": true,
"number_sections": true,
"sideBar": true,
"threshold": 4,
"toc_cell": false,
"toc_section_display": "block",
"toc_window_display": true,
"widenNotebook": false
},
"toc_position": {
"height": "616px",
"left": "0px",
"right": "20px",
"top": "106px",
"width": "213px"
}
},
"nbformat": 4,
"nbformat_minor": 0
}