CommencerCommencer gratuitement

Explore and clean company listing information

To get started with the construction of a market-value based index, you'll work with the combined listing info for the three largest US stock exchanges, the NYSE, the NASDAQ and the AMEX.

In this and the next exercise, you will calculate market-cap weights for these stocks.

We have already imported pandas as pd, and loaded the listings data set with listings information from the NYSE, NASDAQ, and AMEX. The column 'Market Capitalization' is already measured in USD mn.

Cet exercice fait partie du cours

Manipulating Time Series Data in Python

Afficher le cours

Instructions

  • Inspect listings using .info().
  • Move the column 'Stock Symbol' into the index (inplace).
  • Drop all companies with missing 'Sector' information from listings.
  • Select companies with IPO Year before 2019.
  • Inspect the result of the changes you just made using .info().
  • Show the number of companies per 'Sector' using .groupby() and .size(). Sort the output in descending order.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Inspect listings
print(____)

# Move 'stock symbol' into the index


# Drop rows with missing 'sector' data


# Select companies with IPO Year before 2019
listings = ____

# Inspect the new listings data
print(____)

# Show the number of companies per sector
print(____)
Modifier et exécuter le code