When your stats textbook speaks R but you think in Python
Because the classic ISLR textbook teaches in R, but the author thinks in Python.

What it does
The repository contains Jupyter Notebooks that replicate a selection of tables, figures, and LAB sections from the first edition of An Introduction to Statistical Learning (the “ISLR” textbook). It covers the standard curriculum from linear regression through unsupervised learning, using pandas, scikit-learn, statsmodels, and seaborn instead of the book’s original R code. The author built it as a learning exercise while working through the chapters.
The interesting bit
The notebooks deliberately chase pixel-perfect reproductions of the book’s R plots and tables—not because the world needed identical output, but because reverse-engineering matplotlib and seaborn to match base R graphics is an oddly effective way to master both the libraries and the underlying statistical concepts.
Key highlights
- Covers Chapters 3–10: linear regression, classification, resampling, regularization, non-linearity, trees, SVMs, and unsupervised learning.
- Includes an extra notebook simulating expected misclassification rates for SVM and logistic regression.
- Uses the
python-glmnetwrapper (Fortran-backed, via the R package’s engine) for Ridge and Lasso examples in Chapter 6. - Explicitly not a standalone tutorial; designed as a companion to the physical or PDF textbook.
Caveats
- The code targets the 2013 first edition, even though a second edition exists (2021).
- Package versions were last locked and tested in 2018; several dependencies have likely evolved or deprecated since then.
- The author notes you will need the actual book to follow along; the notebooks are not self-contained explanations.
Verdict Worth bookmarking if you are working through ISLR and want to see how the R labs map to Python idioms. Skip it if you are looking for a generic, book-free machine-learning course or need second-edition material.
Frequently asked
- What is JWarmenhoven/ISLR-python?
- Because the classic ISLR textbook teaches in R, but the author thinks in Python.
- Is ISLR-python open source?
- Yes — JWarmenhoven/ISLR-python is open source, released under the MIT license.
- What language is ISLR-python written in?
- JWarmenhoven/ISLR-python is primarily written in Jupyter Notebook.
- How popular is ISLR-python?
- JWarmenhoven/ISLR-python has 4.4k stars on GitHub.
- Where can I find ISLR-python?
- JWarmenhoven/ISLR-python is on GitHub at https://github.com/JWarmenhoven/ISLR-python.