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.
Latihan ini adalah bagian dari kursus
Manipulating Time Series Data in Python
Petunjuk latihan
- Inspect
listingsusing.info(). - Move the column
'Stock Symbol'into the index (inplace). - Drop all companies with missing
'Sector'information fromlistings. - 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.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# 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(____)