Before you turn this problem in, make sure everything runs as expected. First, restart the kernel (in the menubar, select Kernel$\rightarrow$Restart) and then run all cells (in the menubar, select Cell$\rightarrow$Run All).

Make sure you fill in any place that says YOUR CODE HERE or "YOUR ANSWER HERE", as well as your name and collaborators below:

In [ ]:
NAME = ""
COLLABORATORS = ""

In [ ]:
import os
import os.path
import pandas as pd

datadir = "publicdata"
In [ ]:
path = os.path.join(datadir, "topnames.csv")
topnames0 = pd.read_csv(path)
topnames = topnames0.set_index(['year', 'sex'])
names0 = topnames0.head(10)
names = topnames.head(10)
In [ ]:
path = os.path.join(datadir, "indicators.csv")
indicators0 = pd.read_csv(path)
indicators = indicators0.set_index(['code', 'year'])
rowinclude = lambda code, year: code in ['CAN', 'IND', 'USA'] and year >= 2013
z = zip(indicators0['code'], indicators0['year'])
bools = [rowinclude(code, year) for code, year in z]
ind0 = indicators0[bools]
In [ ]:
ind0
In [ ]:
ind0 = ind0.reset_index(drop=True)
ind = ind0.set_index(['code', 'year'])
In [ ]:
ind
In [ ]: