In [1]:
import pandas as pd

In [2]:
from pandas.io.parsers import ExcelFile

In [3]:
files = ["bankCapitalToAssetsRatioWorldBank.xls",	"giniWorldBank.xls",
"governmentDebtWorldBank.xls",		"privateSectorDebtWorldBank.xls",
"currentAccountBalanceWorldBank.xls",	"incomeShareOfTopTenWorldBank.xls",	"surplusDeficitWorldBank.xls",
"gdpWorldBank.xls",			"inflationConsumerPricesWorldBank.xls"]

In [4]:
data_names = map(lambda x: x[:-4], files)

In [5]:
data_names


Out[5]:
['bankCapitalToAssetsRatioWorldBank',
 'giniWorldBank',
 'governmentDebtWorldBank',
 'privateSectorDebtWorldBank',
 'currentAccountBalanceWorldBank',
 'incomeShareOfTopTenWorldBank',
 'surplusDeficitWorldBank',
 'gdpWorldBank',
 'inflationConsumerPricesWorldBank']

In [6]:
xls = ExcelFile("data/" + files[0])
df = xls.parse('Sheet1', index_col=None, na_values=['NA'])

In [7]:
del df['Country Code']

In [8]:
df.index = df['Country Name']

In [9]:
del df['Country Name']

In [9]:


In [9]:


In [10]:
datasets = {}

for name, fn in zip(data_names, files):
    xls = ExcelFile("data/" + fn)
    df = xls.parse('Sheet1', index_col=None, na_values=['NA'])
    df.index = df['Country Name']
    del df['Country Code']
    del df['Country Name']
    datasets[name] = df

In [11]:
datasets


Out[11]:
{'bankCapitalToAssetsRatioWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    0  non-null values
1961    0  non-null values
1962    0  non-null values
1963    0  non-null values
1964    0  non-null values
1965    0  non-null values
1966    0  non-null values
1967    0  non-null values
1968    0  non-null values
1969    0  non-null values
1970    0  non-null values
1971    0  non-null values
1972    0  non-null values
1973    0  non-null values
1974    0  non-null values
1975    0  non-null values
1976    0  non-null values
1977    0  non-null values
1978    0  non-null values
1979    0  non-null values
1980    0  non-null values
1981    0  non-null values
1982    0  non-null values
1983    0  non-null values
1984    0  non-null values
1985    0  non-null values
1986    0  non-null values
1987    0  non-null values
1988    0  non-null values
1989    0  non-null values
1990    0  non-null values
1991    0  non-null values
1992    0  non-null values
1993    0  non-null values
1994    0  non-null values
1995    0  non-null values
1996    0  non-null values
1997    0  non-null values
1998    0  non-null values
1999    0  non-null values
2000    92  non-null values
2001    105  non-null values
2002    108  non-null values
2003    110  non-null values
2004    114  non-null values
2005    115  non-null values
2006    111  non-null values
2007    119  non-null values
2008    121  non-null values
2009    122  non-null values
2010    122  non-null values
2011    120  non-null values
2012    84  non-null values
dtypes: float64(53),
 'currentAccountBalanceWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    0  non-null values
1961    0  non-null values
1962    0  non-null values
1963    0  non-null values
1964    0  non-null values
1965    0  non-null values
1966    0  non-null values
1967    0  non-null values
1968    0  non-null values
1969    0  non-null values
1970    0  non-null values
1971    0  non-null values
1972    0  non-null values
1973    0  non-null values
1974    0  non-null values
1975    0  non-null values
1976    0  non-null values
1977    0  non-null values
1978    0  non-null values
1979    0  non-null values
1980    0  non-null values
1981    0  non-null values
1982    0  non-null values
1983    0  non-null values
1984    0  non-null values
1985    0  non-null values
1986    0  non-null values
1987    0  non-null values
1988    0  non-null values
1989    0  non-null values
1990    0  non-null values
1991    0  non-null values
1992    0  non-null values
1993    0  non-null values
1994    0  non-null values
1995    0  non-null values
1996    0  non-null values
1997    0  non-null values
1998    0  non-null values
1999    0  non-null values
2000    0  non-null values
2001    0  non-null values
2002    0  non-null values
2003    0  non-null values
2004    0  non-null values
2005    169  non-null values
2006    170  non-null values
2007    172  non-null values
2008    172  non-null values
2009    172  non-null values
2010    170  non-null values
2011    152  non-null values
2012    64  non-null values
dtypes: float64(53),
 'gdpWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    125  non-null values
1961    126  non-null values
1962    130  non-null values
1963    130  non-null values
1964    130  non-null values
1965    135  non-null values
1966    136  non-null values
1967    139  non-null values
1968    143  non-null values
1969    143  non-null values
1970    153  non-null values
1971    156  non-null values
1972    156  non-null values
1973    156  non-null values
1974    156  non-null values
1975    158  non-null values
1976    159  non-null values
1977    162  non-null values
1978    161  non-null values
1979    163  non-null values
1980    173  non-null values
1981    177  non-null values
1982    179  non-null values
1983    180  non-null values
1984    181  non-null values
1985    186  non-null values
1986    187  non-null values
1987    193  non-null values
1988    195  non-null values
1989    197  non-null values
1990    215  non-null values
1991    214  non-null values
1992    215  non-null values
1993    218  non-null values
1994    220  non-null values
1995    222  non-null values
1996    223  non-null values
1997    224  non-null values
1998    226  non-null values
1999    227  non-null values
2000    231  non-null values
2001    230  non-null values
2002    230  non-null values
2003    229  non-null values
2004    230  non-null values
2005    230  non-null values
2006    229  non-null values
2007    229  non-null values
2008    228  non-null values
2009    225  non-null values
2010    221  non-null values
2011    218  non-null values
2012    202  non-null values
dtypes: float64(53),
 'giniWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    0  non-null values
1961    0  non-null values
1962    0  non-null values
1963    0  non-null values
1964    0  non-null values
1965    0  non-null values
1966    0  non-null values
1967    0  non-null values
1968    0  non-null values
1969    0  non-null values
1970    0  non-null values
1971    0  non-null values
1972    0  non-null values
1973    0  non-null values
1974    0  non-null values
1975    0  non-null values
1976    0  non-null values
1977    0  non-null values
1978    1  non-null values
1979    1  non-null values
1980    2  non-null values
1981    6  non-null values
1982    2  non-null values
1983    2  non-null values
1984    6  non-null values
1985    9  non-null values
1986    11  non-null values
1987    18  non-null values
1988    24  non-null values
1989    17  non-null values
1990    11  non-null values
1991    14  non-null values
1992    30  non-null values
1993    33  non-null values
1994    25  non-null values
1995    28  non-null values
1996    37  non-null values
1997    25  non-null values
1998    47  non-null values
1999    32  non-null values
2000    47  non-null values
2001    39  non-null values
2002    49  non-null values
2003    46  non-null values
2004    48  non-null values
2005    47  non-null values
2006    46  non-null values
2007    44  non-null values
2008    49  non-null values
2009    42  non-null values
2010    35  non-null values
2011    11  non-null values
2012    0  non-null values
dtypes: float64(53),
 'governmentDebtWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    0  non-null values
1961    0  non-null values
1962    0  non-null values
1963    0  non-null values
1964    0  non-null values
1965    0  non-null values
1966    0  non-null values
1967    0  non-null values
1968    0  non-null values
1969    0  non-null values
1970    0  non-null values
1971    0  non-null values
1972    0  non-null values
1973    0  non-null values
1974    0  non-null values
1975    0  non-null values
1976    0  non-null values
1977    0  non-null values
1978    0  non-null values
1979    0  non-null values
1980    0  non-null values
1981    0  non-null values
1982    0  non-null values
1983    0  non-null values
1984    0  non-null values
1985    0  non-null values
1986    0  non-null values
1987    0  non-null values
1988    0  non-null values
1989    0  non-null values
1990    35  non-null values
1991    39  non-null values
1992    42  non-null values
1993    45  non-null values
1994    44  non-null values
1995    64  non-null values
1996    60  non-null values
1997    64  non-null values
1998    68  non-null values
1999    69  non-null values
2000    60  non-null values
2001    60  non-null values
2002    60  non-null values
2003    65  non-null values
2004    64  non-null values
2005    65  non-null values
2006    74  non-null values
2007    76  non-null values
2008    75  non-null values
2009    72  non-null values
2010    69  non-null values
2011    61  non-null values
2012    0  non-null values
dtypes: float64(53),
 'incomeShareOfTopTenWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    0  non-null values
1961    0  non-null values
1962    0  non-null values
1963    0  non-null values
1964    0  non-null values
1965    0  non-null values
1966    0  non-null values
1967    0  non-null values
1968    0  non-null values
1969    0  non-null values
1970    0  non-null values
1971    0  non-null values
1972    0  non-null values
1973    0  non-null values
1974    0  non-null values
1975    0  non-null values
1976    0  non-null values
1977    0  non-null values
1978    1  non-null values
1979    1  non-null values
1980    2  non-null values
1981    6  non-null values
1982    2  non-null values
1983    2  non-null values
1984    6  non-null values
1985    9  non-null values
1986    11  non-null values
1987    18  non-null values
1988    24  non-null values
1989    19  non-null values
1990    11  non-null values
1991    15  non-null values
1992    30  non-null values
1993    33  non-null values
1994    25  non-null values
1995    28  non-null values
1996    37  non-null values
1997    25  non-null values
1998    47  non-null values
1999    33  non-null values
2000    47  non-null values
2001    39  non-null values
2002    49  non-null values
2003    46  non-null values
2004    48  non-null values
2005    47  non-null values
2006    46  non-null values
2007    44  non-null values
2008    49  non-null values
2009    41  non-null values
2010    35  non-null values
2011    11  non-null values
2012    0  non-null values
dtypes: float64(53),
 'inflationConsumerPricesWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    0  non-null values
1961    69  non-null values
1962    71  non-null values
1963    72  non-null values
1964    76  non-null values
1965    82  non-null values
1966    88  non-null values
1967    96  non-null values
1968    97  non-null values
1969    98  non-null values
1970    103  non-null values
1971    105  non-null values
1972    107  non-null values
1973    110  non-null values
1974    114  non-null values
1975    118  non-null values
1976    119  non-null values
1977    124  non-null values
1978    124  non-null values
1979    119  non-null values
1980    125  non-null values
1981    138  non-null values
1982    140  non-null values
1983    140  non-null values
1984    144  non-null values
1985    145  non-null values
1986    151  non-null values
1987    154  non-null values
1988    155  non-null values
1989    159  non-null values
1990    159  non-null values
1991    163  non-null values
1992    167  non-null values
1993    176  non-null values
1994    181  non-null values
1995    186  non-null values
1996    189  non-null values
1997    189  non-null values
1998    189  non-null values
1999    192  non-null values
2000    194  non-null values
2001    198  non-null values
2002    199  non-null values
2003    202  non-null values
2004    203  non-null values
2005    205  non-null values
2006    207  non-null values
2007    209  non-null values
2008    209  non-null values
2009    211  non-null values
2010    211  non-null values
2011    208  non-null values
2012    191  non-null values
dtypes: float64(53),
 'privateSectorDebtWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    77  non-null values
1961    80  non-null values
1962    87  non-null values
1963    92  non-null values
1964    94  non-null values
1965    113  non-null values
1966    115  non-null values
1967    118  non-null values
1968    119  non-null values
1969    120  non-null values
1970    122  non-null values
1971    124  non-null values
1972    127  non-null values
1973    131  non-null values
1974    135  non-null values
1975    139  non-null values
1976    141  non-null values
1977    146  non-null values
1978    145  non-null values
1979    151  non-null values
1980    155  non-null values
1981    156  non-null values
1982    159  non-null values
1983    160  non-null values
1984    160  non-null values
1985    163  non-null values
1986    158  non-null values
1987    158  non-null values
1988    163  non-null values
1989    164  non-null values
1990    169  non-null values
1991    174  non-null values
1992    180  non-null values
1993    191  non-null values
1994    194  non-null values
1995    201  non-null values
1996    201  non-null values
1997    203  non-null values
1998    199  non-null values
1999    204  non-null values
2000    208  non-null values
2001    209  non-null values
2002    210  non-null values
2003    210  non-null values
2004    211  non-null values
2005    211  non-null values
2006    211  non-null values
2007    209  non-null values
2008    207  non-null values
2009    204  non-null values
2010    200  non-null values
2011    196  non-null values
2012    178  non-null values
dtypes: float64(53),
 'surplusDeficitWorldBank': <class 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    0  non-null values
1961    0  non-null values
1962    0  non-null values
1963    0  non-null values
1964    0  non-null values
1965    0  non-null values
1966    0  non-null values
1967    0  non-null values
1968    0  non-null values
1969    0  non-null values
1970    0  non-null values
1971    0  non-null values
1972    0  non-null values
1973    0  non-null values
1974    0  non-null values
1975    0  non-null values
1976    0  non-null values
1977    0  non-null values
1978    0  non-null values
1979    0  non-null values
1980    0  non-null values
1981    0  non-null values
1982    0  non-null values
1983    0  non-null values
1984    0  non-null values
1985    0  non-null values
1986    0  non-null values
1987    0  non-null values
1988    0  non-null values
1989    0  non-null values
1990    44  non-null values
1991    50  non-null values
1992    54  non-null values
1993    54  non-null values
1994    55  non-null values
1995    72  non-null values
1996    72  non-null values
1997    75  non-null values
1998    79  non-null values
1999    86  non-null values
2000    85  non-null values
2001    98  non-null values
2002    114  non-null values
2003    125  non-null values
2004    133  non-null values
2005    128  non-null values
2006    134  non-null values
2007    135  non-null values
2008    134  non-null values
2009    126  non-null values
2010    121  non-null values
2011    113  non-null values
2012    2  non-null values
dtypes: float64(53)}

In [12]:
xls = ExcelFile("data/betterLifeData.xlsx")
better = xls.parse('average_value', index_col=None, na_values=['NA'])

In [13]:
better


Out[13]:
&ltclass 'pandas.core.frame.DataFrame'>
Int64Index: 37 entries, 0 to 36
Data columns (total 26 columns):
COUNTRY                                      37  non-null values
Households’ income                           33  non-null values
Household financial wealth                   32  non-null values
Employment                                   37  non-null values
Personal earnings                            35  non-null values
Job security                                 37  non-null values
Long-term unemployment                       35  non-null values
Rooms per person                             31  non-null values
Housing expenditure                          37  non-null values
Dwellings with basic facilities              33  non-null values
Employees working very long                  34  non-null values
Time devoted to leisure and personal care    24  non-null values
Life expectancy                              37  non-null values
Self-reported health                         35  non-null values
Educational attainment                       36  non-null values
Years in education                           36  non-null values
Students’ skills                             37  non-null values
Social network                               37  non-null values
Consultation on rule-making                  36  non-null values
Voter turn-out                               37  non-null values
Water quality                                37  non-null values
Air pollution                                37  non-null values
Homicide                                     37  non-null values
Assault                                      37  non-null values
Life Satisfaction                            37  non-null values
                                             0  non-null values
dtypes: float64(24), object(2)

In [14]:
better.index


Out[14]:
Int64Index([0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], dtype=int64)

In [15]:
better.index = better.COUNTRY

In [24]:
better.index


Out[24]:
Index([Australia, Austria, Belgium, Brazil, Canada, Chile, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Iceland, Ireland, Israel, Italy, Japan, Korea, Luxembourg, Mexico, Netherlands, New Zealand, Norway, Poland, Portugal, Russian Federation, Slovak Republic, Slovenia, Spain, Sweden, Switzerland, Turkey, United Kingdom, United States, OECD average], dtype=object)

In [31]:
cs = list(better.index)
cs[35] = u'United States'
better.index = cs

In [32]:
better.index


Out[32]:
Index([Australia, Austria, Belgium, Brazil, Canada, Chile, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Iceland, Ireland, Israel, Italy, Japan, Korea, Luxembourg, Mexico, Netherlands, New Zealand, Norway, Poland, Portugal, Russian Federation, Slovak Republic, Slovenia, Spain, Sweden, Switzerland, Turkey, United Kingdom, United States, OECD average], dtype=object)

In [21]:
df = datasets["privateSectorDebtWorldBank"]

In [22]:
df


Out[22]:
&ltclass 'pandas.core.frame.DataFrame'>
Index: 246 entries, Arab World to Zimbabwe
Data columns (total 53 columns):
1960    77  non-null values
1961    80  non-null values
1962    87  non-null values
1963    92  non-null values
1964    94  non-null values
1965    113  non-null values
1966    115  non-null values
1967    118  non-null values
1968    119  non-null values
1969    120  non-null values
1970    122  non-null values
1971    124  non-null values
1972    127  non-null values
1973    131  non-null values
1974    135  non-null values
1975    139  non-null values
1976    141  non-null values
1977    146  non-null values
1978    145  non-null values
1979    151  non-null values
1980    155  non-null values
1981    156  non-null values
1982    159  non-null values
1983    160  non-null values
1984    160  non-null values
1985    163  non-null values
1986    158  non-null values
1987    158  non-null values
1988    163  non-null values
1989    164  non-null values
1990    169  non-null values
1991    174  non-null values
1992    180  non-null values
1993    191  non-null values
1994    194  non-null values
1995    201  non-null values
1996    201  non-null values
1997    203  non-null values
1998    199  non-null values
1999    204  non-null values
2000    208  non-null values
2001    209  non-null values
2002    210  non-null values
2003    210  non-null values
2004    211  non-null values
2005    211  non-null values
2006    211  non-null values
2007    209  non-null values
2008    207  non-null values
2009    204  non-null values
2010    200  non-null values
2011    196  non-null values
2012    178  non-null values
dtypes: float64(53)

In [50]:
cs.remove(u'Slovenia')
cs.remove(u'Korea')
cs.remove(u'OECD average')

In [46]:
for i in xrange(2000,2012):
    figure()
    df[str(i)][cs].plot(kind='bar')
    title(i)



In [47]:
import json

In [70]:
def df_to_yearly_json(df, countries=cs, start=2000, end=2013):
    data = {}
    for year in xrange(start, end):
        d = dict(df[str(year)][countries])
        data[year] = d
    return json.dumps(data)

In [71]:
df_to_yearly_json(df)


Out[71]:
'{"2000": {"Brazil": 31.658735890797228, "Canada": 95.674810069321552, "Italy": 75.514657334512961, "Czech Republic": 47.24533472559088, "Luxembourg": 102.25743690450216, "France": 85.131472622434543, "Slovak Republic": 51.060933661086402, "Ireland": 104.61112475842694, "Norway": 65.499830547608013, "Israel": 76.769717321079654, "Australia": 87.61940344723935, "Iceland": 97.060861813283466, "Germany": 119.44644688644688, "Chile": 69.802603397251403, "Belgium": 77.831102030149324, "Spain": 97.773163339985118, "Netherlands": 134.20159823906596, "Denmark": 135.3288308862, "Poland": 26.576188377410404, "Finland": 53.150270433828815, "Turkey": 17.752138674441596, "United States": 168.40549307356446, "Russian Federation": 13.645696452036793, "Sweden": 42.317961973950396, "Japan": 219.28225395206528, "Switzerland": 154.7030090084339, "New Zealand": 110.00535989949915, "Portugal": 126.27310278525474, "Estonia": 36.144866222339047, "Mexico": 18.311665862292006, "United Kingdom": 129.46619173295437, "Austria": 102.62067149492968, "Greece": 47.403554194936298, "Hungary": 32.457192930307073}, "2001": {"Brazil": 30.384001067795918, "Canada": 178.30623158924524, "Italy": 77.491099904760674, "Czech Republic": 39.089651578460291, "Luxembourg": 129.05626938413823, "France": 87.90170915996714, "Slovak Republic": 37.229089604766131, "Ireland": 109.7211192726372, "Norway": 70.015036889504572, "Israel": 84.94868011085947, "Australia": 88.422451707820827, "Iceland": 98.844061353961351, "Germany": 118.80060897283411, "Chile": 72.253362724994531, "Belgium": 75.949084498639351, "Spain": 101.18372068072023, "Netherlands": 135.29708686689105, "Denmark": 142.56321638560928, "Poland": 27.271402472407651, "Finland": 55.92010797771524, "Turkey": 15.351427589179007, "United States": 176.65959094798757, "Russian Federation": 16.837738718189541, "Sweden": 97.868438298276416, "Japan": 189.56407681875652, "Switzerland": 149.11514874914326, "New Zealand": 108.69314241797159, "Portugal": 133.40561652280675, "Estonia": 39.029597653452392, "Mexico": 15.664309980539908, "United Kingdom": 134.63128457657001, "Austria": 105.06677415204229, "Greece": 57.410125868581432, "Hungary": 33.280083006573932}, "2002": {"Brazil": 30.653703288737145, "Canada": 173.17717175309329, "Italy": 79.577268316090368, "Czech Republic": 29.56647049888414, "Luxembourg": 103.74203556059646, "France": 85.954011834905515, "Slovak Republic": 39.267158314148162, "Ireland": 108.7903978450972, "Norway": 74.740902516987788, "Israel": 89.764969640354977, "Australia": 91.398701408641386, "Iceland": 105.19766653050307, "Germany": 117.52166776099804, "Chile": 73.623762101947989, "Belgium": 74.043630407266775, "Spain": 105.71114749512518, "Netherlands": 141.16385147480514, "Denmark": 145.47484332395791, "Poland": 27.434744947302548, "Finland": 58.342731437004858, "Turkey": 14.521289914704338, "United States": 167.60161474005969, "Russian Federation": 17.991143481379058, "Sweden": 99.113040844972431, "Japan": 186.87550961941071, "Switzerland": 148.37006001701081, "New Zealand": 103.38059593266959, "Portugal": 135.90193416937711, "Estonia": 44.711617416074148, "Mexico": 17.707933109576615, "United Kingdom": 139.22285160289314, "Austria": 104.58026746157405, "Greece": 61.002750520300765, "Hungary": 34.989387955085903}, "2003": {"Brazil": 28.653790972218502, "Canada": 167.03114900982959, "Italy": 83.208547090801829, "Czech Republic": 30.48100391837081, "Luxembourg": 103.12515958810475, "France": 88.664236037770095, "Slovak Republic": 31.84525597332048, "Ireland": 113.77540883244717, "Norway": 77.44425783959376, "Israel": 85.659913035433419, "Australia": 99.403546728301635, "Iceland": 130.38636132987199, "Germany": 116.29471478463329, "Chile": 74.533831692025771, "Belgium": 73.808377118812857, "Spain": 113.17282225871621, "Netherlands": 147.99253582698216, "Denmark": 151.62080947305219, "Poland": 28.070051568155836, "Finland": 64.176017480811652, "Turkey": 14.546437011815867, "United States": 183.27356968589541, "Russian Federation": 21.243567057304027, "Sweden": 99.821287320712642, "Japan": 186.19965168221293, "Switzerland": 152.46684626411792, "New Zealand": 108.76062091068218, "Portugal": 135.37722073412388, "Estonia": 50.648042183992203, "Mexico": 16.004931309414189, "United Kingdom": 143.52997898989614, "Austria": 104.8129940183192, "Greece": 64.767394973659563, "Hungary": 42.709315839812696}, "2004": {"Brazil": 28.950712688141483, "Canada": 170.01757215475024, "Italy": 84.834729357479205, "Czech Republic": 31.340836249970984, "Luxembourg": 106.17061961413035, "France": 90.60670156377391, "Slovak Republic": 30.42509236318654, "Ireland": 133.36853891153169, "Norway": 77.281283946847125, "Israel": 85.118598534793364, "Australia": 103.14320376234913, "Iceland": 164.63137704945356, "Germany": 112.93250444049734, "Chile": 75.566690020978839, "Belgium": 71.189239478589855, "Spain": 124.86015590269275, "Netherlands": 157.83168832861006, "Denmark": 158.15595629458866, "Poland": 28.148437381697672, "Finland": 67.603404568321224, "Turkey": 17.278526942741497, "United States": 191.37509236595383, "Russian Federation": 24.316400949334742, "Sweden": 101.32982231580594, "Japan": 178.92353233002194, "Switzerland": 154.02523394145166, "New Zealand": 112.42620572742285, "Portugal": 135.93771452490583, "Estonia": 60.781325755795955, "Mexico": 15.213503133179751, "United Kingdom": 151.16224025549201, "Austria": 105.97090007606478, "Greece": 70.788577734281105, "Hungary": 45.937743678713467}, "2005": {"Brazil": 31.366304915209291, "Canada": 178.17564929085887, "Italy": 88.993057322486763, "Czech Republic": 35.387842837227574, "Luxembourg": 129.07712383752624, "France": 92.667080702681588, "Slovak Republic": 35.118931258600199, "Ireland": 159.90958386803439, "Norway": 80.859089850402299, "Israel": 89.849103804340587, "Australia": 108.95972046055404, "Iceland": 247.89674901889666, "Germany": 112.59485704010071, "Chile": 76.33080421749743, "Belgium": 73.759124688977877, "Spain": 145.65093071798245, "Netherlands": 165.04157520251962, "Denmark": 171.77977514419931, "Poland": 28.937498347404965, "Finland": 75.050975360321161, "Turkey": 22.248866056781178, "United States": 195.76290046355945, "Russian Federation": 27.507933868768369, "Sweden": 107.85697133829835, "Japan": 192.86825043708808, "Switzerland": 159.13436797731526, "New Zealand": 122.37937794029756, "Portugal": 140.71357313570414, "Estonia": 69.711729399346765, "Mexico": 16.551460393250458, "United Kingdom": 158.54297502989601, "Austria": 115.62797767935167, "Greece": 79.586774060614033, "Hungary": 51.249345827737791}, "2006": {"Brazil": 40.337360625862431, "Canada": 194.19369955288352, "Italy": 94.471830285482213, "Czech Republic": 39.420700179174432, "Luxembourg": 154.67018142896319, "France": 98.431339765238192, "Slovak Republic": 38.681821461480716, "Ireland": 181.04342962614248, "Norway": 86.19218846241175, "Israel": 86.471580986936686, "Australia": 114.12866052467314, "Iceland": 319.46092980061331, "Germany": 109.60089027183544, "Chile": 77.8237761983616, "Belgium": 82.029238243698032, "Spain": 166.98422297465265, "Netherlands": 167.18997586150726, "Denmark": 185.6777672295498, "Poland": 33.291479211457023, "Finland": 78.79890206014538, "Turkey": 25.941625505726012, "United States": 205.7461952257118, "Russian Federation": 32.484803595104857, "Sweden": 112.80766043579851, "Japan": 188.68763161478387, "Switzerland": 163.68822645993518, "New Zealand": 132.14442253554586, "Portugal": 151.90475420781647, "Estonia": 82.802591596853233, "Mexico": 19.662141943986576, "United Kingdom": 170.15475296607977, "Austria": 116.37331195877836, "Greece": 85.243504173860472, "Hungary": 55.601855899576989}, "2007": {"Brazil": 47.853066405486629, "Canada": 127.41598900096693, "Italy": 100.56820889369575, "Czech Republic": 46.281862504856555, "Luxembourg": 184.76776684943781, "France": 105.5766574215038, "Slovak Republic": 42.419324860230425, "Ireland": 200.1470567942122, "Norway": NaN, "Israel": 97.44729394387862, "Australia": 121.14812333312193, "Iceland": 261.38871090190946, "Germany": 105.25126621371217, "Chile": 83.928073589044615, "Belgium": 90.890817861024672, "Spain": 187.88665740565781, "Netherlands": 188.0639694424186, "Denmark": 202.50167525529946, "Poland": 39.443223082133052, "Finland": 81.523105154868489, "Turkey": 29.496044063524092, "United States": 213.92487390606226, "Russian Federation": 38.809519109580442, "Sweden": 121.47412458917384, "Japan": 181.12401925083316, "Switzerland": 167.31855876765624, "New Zealand": 137.12624307584943, "Portugal": 162.49663357729071, "Estonia": 91.329837696455201, "Mexico": 21.750093348889369, "United Kingdom": 186.34930908797347, "Austria": 115.4387472153972, "Greece": 93.912414923346958, "Hungary": 62.566016029147434}, "2008": {"Brazil": 53.095763758544933, "Canada": 128.24788769990107, "Italy": 104.75138343133077, "Czech Republic": 50.58001861027838, "Luxembourg": 193.71178571906401, "France": 108.76316150207299, "Slovak Republic": 44.988957405431243, "Ireland": 221.6377234405727, "Norway": NaN, "Israel": 99.783364693004884, "Australia": 122.15954642233397, "Iceland": 126.66083360949538, "Germany": 108.61472228959495, "Chile": 92.18958395907967, "Belgium": 93.902562251894622, "Spain": 202.83998352620182, "Netherlands": 193.15621525330496, "Denmark": 216.31701073266893, "Poland": 49.638328500096783, "Finland": 85.98373458286207, "Turkey": 32.594105703877993, "United States": 194.62618167132771, "Russian Federation": 42.187328594527443, "Sweden": 127.64324412043742, "Japan": 176.05072371961174, "Switzerland": 157.824977572612, "New Zealand": 148.33274647887325, "Portugal": 173.69090335038732, "Estonia": 96.396187915693403, "Mexico": 20.966046089791281, "United Kingdom": 211.43011011630674, "Austria": 120.29387619521226, "Greece": 97.406634758230922, "Hungary": 69.799110957882405}, "2009": {"Brazil": 48.867117903800199, "Canada": NaN, "Italy": 110.96982428948996, "Czech Republic": 52.020242730805357, "Luxembourg": 194.39329406409172, "France": 111.54838735712931, "Slovak Republic": NaN, "Ireland": 233.54880989197972, "Norway": NaN, "Israel": 93.549471591717321, "Australia": 123.20558832357192, "Iceland": 113.63033979270949, "Germany": 113.40795957043588, "Chile": 70.68704431807673, "Belgium": 97.469324028068399, "Spain": 212.11256989103674, "Netherlands": 214.15265990387886, "Denmark": 223.87316117948811, "Poland": 50.394899952406277, "Finland": 93.887463874928912, "Turkey": 36.484605915605947, "United States": 205.50725624138707, "Russian Federation": 46.152495998903262, "Sweden": 136.23377626948377, "Japan": 183.4379345190705, "Switzerland": 168.8139505935537, "New Zealand": 148.1256204023158, "Portugal": 186.78068845042876, "Estonia": 107.98453146764182, "Mexico": 23.069539053583092, "United Kingdom": 212.60908584015556, "Austria": 126.03285929086934, "Greece": 94.284160701189833, "Hungary": 69.50707824799926}, "2010": {"Brazil": 54.38481799448315, "Canada": NaN, "Italy": 122.89462509041486, "Czech Republic": 53.09527075507534, "Luxembourg": 187.12463736327072, "France": 114.20986556480219, "Slovak Republic": NaN, "Ireland": 214.36651064749478, "Norway": NaN, "Israel": 95.652788661055496, "Australia": 126.35954158619067, "Iceland": 108.74474812957156, "Germany": 106.92893197660445, "Chile": 66.496203349898934, "Belgium": 94.420182605056894, "Spain": 214.39245368644549, "Netherlands": 199.35132656180997, "Denmark": 215.83104122613159, "Poland": 51.913005168132131, "Finland": 95.674959171346117, "Turkey": 44.206969515137537, "United States": 201.40521493067604, "Russian Federation": 43.801422974680129, "Sweden": 135.40284719452794, "Japan": 175.04776273859602, "Switzerland": 167.40145901315029, "New Zealand": 149.03339046824894, "Portugal": 190.6854989167503, "Estonia": 98.429936504795606, "Mexico": 24.706684127246817, "United Kingdom": 202.46652565204911, "Austria": 122.29114266913801, "Greece": 118.64606018981763, "Hungary": 68.795533979754936}, "2011": {"Brazil": 61.349925853161039, "Canada": NaN, "Italy": 122.48720570630287, "Czech Republic": 55.634106911621352, "Luxembourg": 170.6940130229961, "France": 115.89503705120048, "Slovak Republic": NaN, "Ireland": 204.26530540442567, "Norway": NaN, "Israel": 95.093590554061848, "Australia": 123.44448256669691, "Iceland": 97.001391850620848, "Germany": 104.50578569775514, "Chile": 70.438231337213637, "Belgium": 92.572861849662544, "Spain": 205.888155883971, "Netherlands": 198.36055769943169, "Denmark": 208.40633473958957, "Poland": 54.817622512052665, "Finland": 96.6536316092227, "Turkey": 49.973310662482298, "United States": 192.29134032061262, "Russian Federation": 45.814867048329745, "Sweden": 135.88239596744378, "Japan": 174.8172635773162, "Switzerland": 169.36245381329363, "New Zealand": NaN, "Portugal": 192.1800891068329, "Estonia": 84.720055099115299, "Mexico": 25.98424361388804, "United Kingdom": 186.86103227754072, "Austria": 119.75760084708436, "Greece": 121.87691293737093, "Hungary": 65.647675366928851}, "2012": {"Brazil": 68.372192263552591, "Canada": NaN, "Italy": 124.42659360204604, "Czech Republic": 56.908872184219881, "Luxembourg": 165.21130742340583, "France": 115.96347484302747, "Slovak Republic": NaN, "Ireland": 186.1237686019951, "Norway": NaN, "Israel": NaN, "Australia": 123.32488799996879, "Iceland": 96.778097016275538, "Germany": 101.93850692080781, "Chile": 73.245924371071752, "Belgium": 92.16886523899008, "Spain": 188.82694552297468, "Netherlands": 200.24207592593211, "Denmark": 205.79443339283077, "Poland": 53.781007643939041, "Finland": 98.241364947626622, "Turkey": 54.39521741379788, "United States": 193.59052794381057, "Russian Federation": 47.775320066396667, "Sweden": 138.47319817524507, "Japan": 176.73178223237326, "Switzerland": 176.1465627837517, "New Zealand": NaN, "Portugal": 184.15727263704954, "Estonia": 79.255476197999883, "Mexico": 27.687025839377583, "United Kingdom": 178.72070515425261, "Austria": 116.98291756055208, "Greece": 120.70826293295272, "Hungary": 56.361005776319516}}'

WTF? Dataframe . notnull() ['something actually null'] gives the item. Damn it


In [ ]: