計算 Ford 的資產負債表比率
現在我們來看一個真實範例:生產汽車的 Ford Inc。已經上傳一個資料集:balance_sheet,其中包含 Ford Inc 最新一期資產負債表的資料。另有 Key_Figures_Memo 資料集提供 2017 年的銷售額與銷貨成本數據。
我們只關注資產負債表上的一個科目:應收款(Receivables,也可稱為債務人 Debtors),因此需要為此建立篩選條件。在本練習中,你將使用「布林索引(boolean indexing)」來篩選 metric 欄中屬於 Receivables 的列。我們會先指定目標指標('Receivables'),再檢查目標欄位的每一列是否等於該值。這會產生由 True 和 False 組成的布林序列。接著就能用這個序列來篩選原始資料集。
完成篩選後,你可以擷取最近一期的應收款金額,並計算債務人天數比率(公式如下)。
\(Debtor Days = \frac{Ending\,Balance\,Debtors}{Sales} \times Days\,in\,Financial\,Year\)
balance_sheet 與 sales 數值已提供。
本練習屬於課程
使用 Python 進行財務預測
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create the filter metric for Receivables
receivables_metric = ____
# Create a boolean series with your metric
receivables_filter = balance_sheet.____.____(____)
# Use the series to filter the dataset
filtered_balance_sheet = ____[____]