1. Learn
  2. /
  3. Courses
  4. /
  5. Analyzing Financial Statements in Python

Connected

Exercise

Compute ratios by industry

In this exercise, you will assess how the current ratio and debt-to-equity ratio of Tech and FMCG companies are different on average and over time.

An industry's ratio, on average gives us an overall idea of the industry's financial condition. On the other hand, an industry's ratio over timehelps us understand its trends: is the ratio relatively stable or fluctuating over time? Is it improving or worsening?

balance_sheet has been loaded for you as a pandas DataFrame. The current ratio is provided in a column called curr_ratio, and the debt-to-equity ratio is provided in a column called debt_to_equity. pandas has been loaded with the alias pd.

Instructions

100 XP
  • Select those companies whose column comp_type is tech or fmcg.
  • Use .groupby() to compute the average current ratio and debt-to-equity ratio grouped by company type (denoted by the column "comp_type").
  • Use .groupby() to compute the average current ratio and debt-to-equity ratio by both "comp_type" and "Year".