Contents
Contents
Tap any chapter to start reading.
Chapter 0 Basics of PythonVariables, strings, booleans, if/else, loops, and functions — assumes zero prior coding experience.
Chapter 1 Python EssentialsLists, list comprehension, pandas Series, NumPy arrays, SciPy distributions, and Matplotlib plotting.
Chapter 2 DataFramesLoad, explore, select, modify, plot. Missing values, standardization, time series methods.
Chapter 3 Linear RegressionCAPM, Fama–French, inference, train/test, residual diagnostics, multiple regression on real pharmacy profit data.
Chapter 4 ClusteringK-Means, hierarchical clustering, customer segmentation, Forbes financial case study.
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 downloads once on the first chapter — after that, everything is instant.
- Read in order if you’re new to programming — each chapter builds on the last.
- Edit the code cells. Break things on purpose. That’s how you learn.
- If a chapter feels long, take a break. Bookmark the page (it remembers where you are).
- Skip nothing in Chapters 0 and 1 — they are the foundation.