การวิเคราะห์งบการเงินด้วย Python
Rohan Chatterjee
Risk Modeler
JSON ("JavaScript Object Notation")JSON ได้JSON เข้า Python ได้ด้วย pandascash_flow = pd.read_json("cash_flow_statement.json")
print(cash_flow.head())

สัดส่วนของกระแสเงินสดจากกิจกรรมดำเนินงานต่อกำไรสุทธิ
กิจกรรมดำเนินงานคือกิจกรรมหลักของธุรกิจ
อัตราส่วนสูงบ่งชี้ว่าธุรกิจสร้างกระแสเงินสดจากกิจกรรมดำเนินงานในสัดส่วนที่มาก
สูตร:
$$\dfrac{\text{Cash flow from operating activities}}{\text{Net income}}$$
สูตร:
$$\dfrac{\text{Cash flow from operating activities}}{\text{Current liabilities}}$$
dataset บางรายการของ "Total Current Liabilities" มีค่าขาดหาย ซึ่งแสดงด้วย NaN
imputation = dataset.groupby("company")["Total Current Liabilities"].transform("mean")
dataset["Imputed Total Current Liabilities"] = dataset["Total Current Liabilities"].fillna(imputation)
dataset จะมีลักษณะดังนี้:
การประมาณค่าที่ขาดหายด้วยค่าเปอร์เซนไทล์ที่ 70 ของค่าที่มีอยู่จะให้การประมาณที่อนุรักษ์นิยมมากขึ้น
การคำนวณอัตราส่วนด้วยค่าประมาณที่อนุรักษ์นิยมกว่าอาจเหมาะสมกว่าเมื่อนำไปใช้ตัดสินใจ
company:imputation = dataset.groupby("company")["Total Current Liabilities"]\
.transform(lambda x: np.nanquantile(x, 0.7))
dataset["Imputed Total Current Liabilities"] = dataset["Total Current Liabilities"]\
.fillna(imputation)
การวิเคราะห์งบการเงินด้วย Python