整體分析
要判斷一家公司財務表現是否良好,應該看看它與同產業競爭對手的比較。
在本練習中,你將計算多年間各家公司的平均負債股東權益比、資產週轉率、流動比率,以及毛利率。
你也會計算多年間在 FMCG、Tech 與 Real Estate 這些產業中的上述比率平均值,並比較各家公司與其所屬產業平均之間的差異。
本練習屬於課程
使用 Python 分析財務報表
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Compute average by company in each industry
company_avg = statement_info.pivot_table(index=____, values=["debt_to_equity"
,"current_ratio"
,"asset_turnover", "gross_margin"]).reset_index()
# Compute average in industry
industry_avg = statement_info.pivot_table(index=____, values=["debt_to_equity"
,"current_ratio"
,"asset_turnover", "gross_margin"]).reset_index()
industry_avg["company"] = "average"
plot_df = pd.concat([company_avg, industry_avg])