始める無料で始める

業種別に比率を計算する

この演習では、Tech と FMCG 企業の流動比率と負債資本比率が、平均的に、また時間の経過とともにどう異なるかを評価します。

業種の比率を平均で見ると、その業種の財務状態の全体像をつかめます。一方、業種の比率を時系列で見ると、傾向が分かります。比率は時間とともに安定しているのか、それとも変動しているのか。改善しているのか、悪化しているのか。

balance_sheetpandas の DataFrame として読み込まれています。流動比率は curr_ratio 列、負債資本比率は debt_to_equity 列にあります。pandas はエイリアス pd で読み込まれています。

この演習はコースの一部です

Pythonで学ぶ財務諸表分析

コースを見る

演習の手順

  • comp_typetech または fmcg の企業を選択します。
  • .groupby() を使って、会社タイプ(列 "comp_type")ごとに流動比率と負債資本比率の平均を計算します。
  • .groupby() を使って、"comp_type""Year" の両方でグループ化し、流動比率と負債資本比率の平均を計算します。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Choose the tech and fmcg companies
tech_fmcg = balance_sheet.loc[balance_sheet[____].isin(____)]

# Compute the average debt-to-equity ratio and current ratio by industry
groupby_industry = tech_fmcg.____(____)[["current_ratio", "debt_to_equity"]].____

# Compute the average debt-to-equity ratio and current ratio by industry and over time
groupby_industry_time = tech_fmcg.____(____)[["current_ratio", "debt_to_equity"]].____

print(groupby_industry)
print(groupby_industry_time)
コードを編集して実行