Get startedGet started for free

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.

This exercise is part of the course

Analyzing Financial Statements in Python

View Course

Exercise instructions

  • Subset the entries in balance_sheet to get only fmcg companies in the column "comp_type" of balance_sheet.
  • Add a column in fcmg where you compute the equity multiplier ratio.
  • Add a column to fmcg where you compute the average yearly equity multiplier ratio.
  • Add a column to fmcg where you compute the relative difference of the company's equity multiplier ratio with its industry average.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# 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"]])
Edit and Run Code