Exercise

Visualize your index constituent correlations

To better understand the characteristics of your index constituents, you can calculate the return correlations.

Use the daily stock prices or your index companies, and show a heatmap of the daily return correlations!

Instructions

100 XP

We have already imported pandas as pd, matplotlib.pyplot as plt, and seaborn as sns. We have also loaded the historical price series of your index constituents into the variable stock_prices.

  • Inspect stock_prices using .info().
  • Calculate the daily returns for stock_prices and assign the result to returns.
  • Calculate the pairwise correlations for returns, assign them to correlations and print the result.
  • Plot a seaborn annotated heatmap of the daily return correlations with the title 'Daily Return Correlations'.