Compute relative difference by industry
Computing the relative difference between a company's ratio and its industry average is an excellent way to see if a company is at par with its peers. In this exercise, you'll practice computing the relative difference of the equity multiplier ratio of various FMCG companies from their industry average.
A pandas DataFrame balance_sheet has been loaded for you. pandas has been loaded for you under the alias pd. You can call balance_sheet.columns in the console to assess which columns you can use for the exercise.
Deze oefening maakt deel uit van de cursus
Analyzing Financial Statements in Python
Oefeninstructies
- Subset the entries in
balance_sheetto get onlyfmcgcompanies in the column"comp_type"ofbalance_sheet. - Add a column in
fcmgwhere you compute the equity multiplier ratio. - Add a column to
fmcgwhere you compute the average yearly equity multiplier ratio. - Add a column to
fmcgwhere you compute the relative difference of the company's equity multiplier ratio with its industry average.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Subset the fmcg companies
fmcg = balance_sheet.____[____]
# Compute equity multiplier ratio
fmcg["equity_multiplier_ratio"] = ____
# Compute average equity multiplier ratio by year
fmcg["average_equity_multiplier_ratio"] = fmcg.____(____)[____].____(____)
# Compute the relative difference
fmcg["relative_difference"] = ____
print(fmcg[["Year", "company", "relative_difference"]])