In [1]:
import sys
import os
sys.path.append(os.path.abspath('../../lib')) 

import sources

In [16]:
# from importlib import reload
# reload(sources)
%matplotlib inline

In [5]:
df = sources.world_bank("NY.GDP.MKTP.CD")

In [11]:
df.index.values


Out[11]:
array([('ABW', Period('1960', 'A-DEC')), ('ABW', Period('1961', 'A-DEC')),
       ('ABW', Period('1962', 'A-DEC')), ...,
       ('ZWE', Period('2014', 'A-DEC')), ('ZWE', Period('2015', 'A-DEC')),
       ('ZWE', Period('2016', 'A-DEC'))], dtype=object)

In [5]:
"as.asd.as".replace(".","_")


Out[5]:
'as_asd_as'

In [12]:
us = df["USA"]

In [25]:
# import pandas as pd
# pd.DataFrame({'gdp': us['1970':'1980'], 'gdp_1':us.shift(1)['1970':'1980']})


Out[25]:
pandas.core.series.Series

In [55]:
a = us['1980' : '1990'].reindex(pd.period_range('1980','2010',freq='A'))
b = us['2000' : '2010'].reindex(pd.period_range('1980','2010',freq='A'))
(a.combine_first(b) / 1e12).plot()
# us['1980' : '1990'].align(us['2000' : '2010'])


Out[55]:
<matplotlib.axes._subplots.AxesSubplot at 0x1104046a0>

In [ ]: