Practice: Oil vs Banks During Recession

Let’s practice what you’ve learned so far by create a data set from our CSV files and doing some modifications.

Task 1: Combining all datasets

Combine all the bank (RBC, CIBC, BMO) and oil company (Suncor, Encana, CNQ) datasets into a single dataset bo (b for bank and o for oil) and check the head of the dataset.

Hint: Use tickers = ['RBC', 'CIBC', 'BMO', 'Suncor', 'Encana','CNQ'] to add a hierarchical index at the outermost level of the data with the keys option in pd.concat().

To see the sample output, run the code segment below:

Get hands-on with 1400+ tech skills courses.