Chapter 29 Further Reading: Financial Modeling with Python
Books
"Financial Modeling" by Simon Benninga The standard academic and practitioner reference for financial modeling. Excel-focused, but the conceptual frameworks for income statement modeling, DCF valuation, and scenario analysis are directly applicable to Python implementations. The chapters on working capital modeling and sensitivity analysis are especially relevant.
"Investment Valuation: Tools and Techniques for Determining the Value of Any Asset" by Aswath Damodaran Damodaran is the preeminent teacher of valuation. This book covers DCF, relative valuation, and real options in depth. His website (damodaran.com) provides free datasets, spreadsheets, and lecture notes. The conceptual chapters on estimating discount rates and terminal values are essential reading for anyone building NPV models.
"The McKinsey Guide to Financial Modeling" (Koller, Goedhart, Wessels) Known as "Valuation" in practitioner circles. Covers enterprise DCF modeling, the relationship between accounting and cash flows, and how professional analysts build multi-year models. Dense but definitive.
"Python for Finance" by Yves Hilpisch Specifically focused on Python applications in finance. Covers quantitative methods, option pricing, risk management, and financial data analysis with NumPy, pandas, and matplotlib. Goes well beyond what this chapter covers — a good next step after mastering the basics here.
"Financial Intelligence for Entrepreneurs" by Karen Berman and Joe Knight A plain-language introduction to reading financial statements and understanding what the numbers actually mean. An excellent companion to the technical content in this chapter — understanding why financial metrics matter makes you a better modeler.
Online Resources
Damodaran Online (pages.stern.nyu.edu/~adamodar) Professor Damodaran's website contains decades of free resources: course notes, valuation spreadsheets, data on risk premiums and discount rates by industry, and video lectures. The datasets on WACC by sector and industry-level financial ratios are particularly useful for calibrating model assumptions.
numpy-financial Documentation
https://numpy.org/numpy-financial/latest/
The official documentation for the numpy-financial package, which provides npv(), irr(), pmt(), pv(), and other standard financial functions. Useful reference once you understand the underlying mathematics.
Python for Finance (Real Python) https://realpython.com/python-finance-part-1/ A practical tutorial series on financial analysis with Python. Covers pandas, matplotlib, and basic financial calculations with well-explained examples.
The 100 Page Python Intro to Finance (Quantopian/QuantLib community resources) Various community-written guides on applying Python to financial analysis, available through GitHub and Medium. Search for "Python financial modeling pandas" for current, practical examples.
Tools and Libraries
numpy-financial
pip install numpy-financial
Standard financial functions (npv, irr, pmt, fv, pv). A separate package from numpy since version 1.17. Use this for production implementations; build manual versions (as this chapter teaches) to understand the underlying math.
openpyxl / xlsxwriter
pip install openpyxl xlsxwriter
Libraries for reading and writing formatted Excel files from Python. Essential for producing board-ready output from Python models. openpyxl is better for reading and modifying existing files; xlsxwriter is better for creating new formatted workbooks from scratch.
pandas
Already covered extensively in this book. For financial modeling specifically, look at:
- pd.DataFrame.pct_change() for growth rate calculations
- pd.DataFrame.cumsum() for cumulative cash flows
- pd.DataFrame.rolling() for moving averages in time-series financial data
scipy.optimize
The scipy.optimize.brentq() function provides a robust root-finding algorithm that can solve for IRR without the convergence issues of Newton-Raphson. Worth knowing for production financial software:
from scipy.optimize import brentq
irr_value = brentq(lambda r: sum(cf/(1+r)**t
for t, cf in enumerate(cash_flows)),
a=-0.9999, b=10.0)
matplotlib
For the specific chart types in this chapter:
- Break-even charts: fill_between() for shaded zones
- Scenario comparison: plot() with multiple series, distinct colors, and markers
- NPV profiles: axhline() for the zero line, axvline() for the hurdle rate
Concepts to Explore Further
Weighted Average Cost of Capital (WACC) The full cost-of-capital calculation that professional analysts use as a discount rate. It blends the cost of equity (from the Capital Asset Pricing Model) and the after-tax cost of debt, weighted by the capital structure. Understanding WACC is the next step after understanding NPV.
Terminal Value In DCF models, the terminal value represents the value of all cash flows beyond the explicit projection period. Typically calculated using either a perpetuity growth model (Gordon Growth Model) or an exit multiple. Terminal value often represents 60-80% of total DCF value — making it the most important and most uncertain component of a valuation.
Monte Carlo Simulation for Financial Models
Instead of three discrete scenarios, Monte Carlo simulation runs thousands of scenarios with randomly drawn assumptions (from probability distributions). This produces a full distribution of outcomes rather than three points. The numpy.random module makes this straightforward in Python. See Exercise 4.3 for an introduction.
Real Options An extension of NPV analysis that treats the flexibility to expand, delay, or abandon a project as having quantifiable value. A project with a negative NPV under conservative assumptions might still be worth pursuing if the option to expand has significant value. Black-Scholes and binomial tree models are used for real options valuation.
LBO (Leveraged Buyout) Modeling A specialized form of financial modeling used in private equity. The model includes an acquisition financing structure (debt and equity mix), interest schedules, debt paydown, and an exit analysis. Mastering LBO modeling is a common goal for investment banking and private equity analysts.
Practice Datasets
The following publicly available datasets are useful for practicing financial modeling:
SEC EDGAR (sec.gov/edgar) All public company financial filings. Download 10-K annual reports for income statement, balance sheet, and cash flow data to practice building models from real numbers.
Quandl/Nasdaq Data Link Financial data API with free and paid tiers. Useful for pulling historical financial statement data directly into Python.
Yahoo Finance (via yfinance library)
pip install yfinance
Pull historical stock prices, financial statements, and company data directly into pandas DataFrames. Great for building DCF models from real public company data.