Python ile Finansal Tabloları Analiz Etme
Rohan Chatterjee
Risk modeler
Formül:
$$\dfrac{\text{Total Revenue}}{\text{Total Assets}}$$
merged_dat = pd.merge(income_statement, balance_sheet, on = ["Year", "company"])
merged_dat artık oranı hesaplamak ve DataFrame’e yeni bir sütun olarak eklemek için kullanılabilirmerged_dat["asset_turnover"] = merged_dat["Total Revenue"] / merged_dat["Total Assets"]
balance_sheet["current_ratio"] = balance_sheet["Total Current Assets"] / balance_sheet["Total Current Liabilities"]
balance_sheet["debt_to_equity"] = balance_sheet["Total Liab"] / balance_sheet["Total Stockholder Equity"]
def compute_ratio(df, numerator, denominator, ratio_name):
df[ratio_name] = df[numerator]/df[denominator]
return df
----CODE_GLUE----
balance_sheet DataFrame’inden compute_ratio ile cari oran ve borç/özsermaye oranını hesaplayın:
balance_sheet = compute_ratio(balance_sheet, "Total Current Assets",
"Total Current Liabilities", "current_ratio")
balance_sheet = compute_ratio(balance_sheet, "Total Liab",
"Total Stockholder Equity", "debt_to_equity")
list_of_numerators = ["Total Current Assets", "Total Liab"]
list_of_denominators = ["Total Current Liabilities",
"Total Stockholder Equity"]
list_of_ratio_names = ["current_ratio", "debt_to_equity"]
Listeler üzerinde döngü kurup compute_ratio fonksiyonunu çağırın:
for numerator, denominator, ratio_name in zip(list_of_numerators,
list_of_denominators,
list_of_ratio_names):
balance_sheet = compute_ratio(balance_sheet,
numerator,
denominator,
ratio_name)
Python ile Finansal Tabloları Analiz Etme