In [1]:
import warnings
warnings.simplefilter('ignore', FutureWarning)
In [2]:
from pandas_datareader import wb
import matplotlib.pyplot as plt
In [3]:
df = wb.download(indicator='SP.POP.TOTL', country=['JP', 'US'],
start=1960, end=2014)
print(df)
In [4]:
df2 = df.unstack(level=0)
print(df2.head())
In [5]:
print(df2.tail())
In [6]:
print(df2.columns)
In [7]:
df2.columns = ['Japan', 'United States']
print(df2.head())
In [8]:
df2.plot(grid=True)
plt.savefig('data/dst/pandas_datareader_wb.png')
plt.close()