Menganalisis Laporan Keuangan dengan Python
Rohan Chatterjee
Risk Modeler
pandas bernama balance_sheet.
print(balance_sheet.head())

balance_sheet["current_ratio"] = balance_sheet["Total Current Assets"] /
balance_sheet["Total Current Liabilities"]
print(balance_sheet.head())

balance_sheet.groupby("comp_type")["current_ratio"].mean()

balance_sheet.groupby(["Year","comp_type"])["current_ratio"].mean()

.transform() dapat digunakan setelah .groupby() untuk menambahkan hasil groupby ke baris sesuai grup tiap baris.balance_sheet["industry_curr_ratio"] =
balance_sheet.groupby([
"Year","comp_type"])["current_ratio"].transform("mean")
print(balance_sheet.head())

balance_sheet["relative_diff"] =
(balance_sheet["current_ratio"] /
balance_sheet["industry_curr_ratio"]) - 1

.isin() digunakan untuk menyaring data.fmcg dan tech pada 2019 dan 2020:fmcg_2019 = balance_sheet.loc[
(balance_sheet["Year"].isin([2019,2020])) &
(balance_sheet["comp_type"].isin(["tech","fmcg"]))
]
Menganalisis Laporan Keuangan dengan Python