Session Ready
Exercise

Select and inspect index components

Now that you have imported and cleaned the listings data, you can proceed to select the index components as the largest company for each sector by market capitalization.

You'll also have the opportunity to take a closer look at the components, their last market value, and last price.

Instructions
100 XP

We have already imported pandas as pd, and loaded the listings data with the modifications you made during the last exercise.

  • Use .groupby() and .nlargest() to select the largest company by 'Market Capitalization' for each 'Sector', and assign the result to components.
  • Print components, sorted in descending order by market cap.
  • Select Stock Symbol from the index of components, assign it to tickers and print the result.
  • Create a list info_cols that holds the column names Company Name, Market Capitalization, and Last Sale. Next, use .loc[] with tickers and info_cols to print() more details about the listings sorted in descending order by Market Capitalization).