Contents
Contents
Tap any chapter to start reading. Each chapter has a companion slide deck at statpython.pages.dev.
Chapter 0 Basics of PythonPython as a calculator, numbers, strings, lists, tuples, sets, dictionaries, control flow, comprehensions, functions, error handling, modules, NumPy arrays and SciPy probabilities.
Chapter 1 Data Structures and Methods of SeriesSeries foundations: structures, arithmetic, summaries, cleaning, selection, time-series features and labelled charts, following a numbered learning path.
Chapter 2 DataFramesA numbered data-engineering path: table foundations, evidence-led audit and repair, grouped tables, validated joins, feature pipelines and research applications, with a 3.5-hour classroom route.
Chapter 3 Reshaping StatisticsStatistics across business applications: distributions of customer and operating measurements, sampling uncertainty, experiments and multiple comparisons, association and cohort prediction evaluation, followed by portfolio loss and tail risk.
Chapter 4 Statistical Predictive ModelsBusiness prediction across delivery, inventory, customers, fraud and finance: target definitions, losses and decision costs; OLS, inference, model selection, nonlinear learners, causal designs, attention and walk-forward evaluation.
Chapter 5 Bayesian Methods for Investment ResearchBayesian foundations for investment research: priors, posterior and predictive checks, robust regression, sequential learning, hierarchical stock signals, model uncertainty and walk-forward portfolio evidence.
Chapter 6 Time Series Models for Volatility and RiskTime-series models for volatility: clustering, ARCH/GARCH, asymmetric shocks, variance forecasts, VaR and volatility targeting. Stationarity, chronological evaluation, relationships and hidden states provide the supporting tools.
Chapter 7 Modern Statistical Learning in PracticeRanking, prediction intervals, partial effects, covariance and cluster allocation, event labels and selection uncertainty. Seven sections connect the statistical methods to a revisable, source-linked coding reference.
How to read this book
Every Python code block in this book runs live in your browser. Click into any cell, edit it, press the ▶ Run button, and see the output. The Python engine (Pyodide) downloads once on the first chapter — after that, everything is instant. Cells marked predict the output hide their result until you have committed to a guess; flashcards at the end of each section are scheduled by a spaced-repetition engine, so the ones you get wrong come back sooner.
This book follows ISOM 5650 lecture by lecture: Chapters 0–2 are the Python and pandas toolkit; Chapters 3–5 are the statistical models the course is graded on — predictive models, Bayesian methods, and time series; Chapter 6 is the capstone on modern statistical learning in practice.
Chapters 0–2 teach you to hold data properly — Python, Series, DataFrames — and to reshape your statistical thinking from averages to distributions, tests, associations and tails. Chapters 3–5 are the modelling core: predictive models with honest selection and a causal detour, Bayesian updating for risk and reward, and time-series models re-positioned for what they still do best in trading — volatility, structural arbitrage, and the walk-forward discipline behind every ML pipeline. Chapter 6 collects six statistical-learning methods that have become everyday practice across industries — demonstrated here on market data — and shows, method by method, how each rests on what came before.
This is not a course on neural networks, reinforcement learning, or production MLOps. Those are downstream of the foundations covered here. Get the foundations right; the rest is implementation.