Session Ready
Exercise

Calculate number of shares outstanding

The next step towards building a value-weighted index is to calculate the number of shares for each index component.

The number of shares will allow you to calculate the total market capitalization for each component given the historical price series in the next exercise.

Instructions
100 XP

We have already imported pandas as pd, tickers and listings as in the previous exercises.

  • Inspect listings and print tickers.
  • Use .loc[] with the list of tickers to select the index components and the columns 'Market Capitalization' and 'Last Sale'; assign this to components.
  • Print the first five rows of components.
  • Create no_shares by dividing Market Capitalization by 'Last Sale'.
  • Print no_shares in descending order.