Data Science from Scratch
First Principles with Python
By Joel Grus
Synopsis
Joel Grus wrote Data Science from Scratch on the premise that people understand statistical and machine learning methods best when they build them by hand before relying on libraries. The book opens with a crash course in Python and then implements, in plain code, the linear algebra, statistics, probability and gradient descent that underpin the field. From there it constructs working versions of k-nearest neighbors, naive Bayes, linear and logistic regression, decision trees, neural networks and clustering, alongside chapters on collecting and cleaning data, visualization, recommender systems, network analysis and natural language processing.
The 2019 second edition, the current version, moves the code to Python 3.6 with type annotations, repairs broken examples and adds chapters on deep learning and data ethics. Its deep learning chapter builds a small neural network library from first principles, and the language chapter now covers word vectors and recurrent networks. The code is written for teaching rather than production, and Grus keeps the tone conversational and often funny. Readers finish with a working mental model of what libraries such as scikit-learn and PyTorch do internally, which makes later work with those tools far less opaque.
Scorecard
Editorial score
How it scored
Editorial score: 70.5 / 1005 weighted criteria
- 22.5/30
Influence30%
- 17.5/25
Authority25%
- 15.0/20
Practical value20%
- 7.5/15
Currency15%
- 8.0/10
Readability10%
- 70.5/100
Editorial score
How the rank was computed
Rank No. 253 of 500 comes from a composite of 54.6: observable signals 22.8 of 55 points plus editorial review 31.8 of 45 points.
All 11 inputs
| Input | Points |
|---|---|
| Observable signals | 22.8/55 |
| Reach (Amazon ratings volume) | 10.6/16.5 |
| Consensus across best-of lists | 5.5/13.8 |
| Awards and bestseller evidence | 0.0/8.3 |
| Reader rating, sample-adjusted | 5.5/8.3 |
| Amazon sales rank | 1.2/5.5 |
| Recency | 0.0/2.8 |
| Editorial review | 31.8/45 |
| Author authority | 7.9/11.3 |
| Influence | 10.1/13.5 |
| Practical value | 6.8/9.0 |
| Readability | 3.6/4.5 |
| Currency | 3.4/6.8 |
Each criterion is scored from 1 to 10 and weighted, and the points add up to the editorial score. The rank combines observable signals (55 percent) with this score (45 percent). Read the methodology.
Verdict
A clear, code-first tour of data science fundamentals that builds understanding by implementing each core algorithm in plain Python.
Strengths
- Readable, well-commented teaching code
- Builds math foundations alongside algorithms
- Second edition adds deep learning and ethics
Keep in mind
The from-scratch code is deliberately slow and unsuited to production, and the 2019 edition predates transformers, large language models and current library practice.
Key takeaways
- Implementing an algorithm by hand, even inefficiently, exposes assumptions and failure modes that a single library call keeps hidden.
- Linear algebra, probability, statistics and gradient descent form the shared foundation beneath nearly every model the book builds.
- Much of practical data science is collecting, cleaning and reshaping data, work that deserves as much care as choosing a model.
- A neural network is a composition of simple, testable layers and loss functions that a programmer can build and train from scratch.
Notable facts
- The 2019 second edition moved the code from Python 2.7 to Python 3.6 and added new chapters on deep learning and data ethics. Source (opens in a new tab)
About the author
Questions
Is Data Science from Scratch worth reading in 2026?
Do I need math or Python experience for Data Science from Scratch?
What changed in the second edition of Data Science from Scratch?
Related books
- Deep Reinforcement Learning Hands-On Maxim Lapan
- Introduction to Machine Learning with Python Andreas C. Müller and Sarah Guido
- Machine Learning System Design Interview Ali Aminian and Alex Xu
- Springer Handbook of Robotics Bruno Siciliano and Oussama Khatib
- Machine Learning Engineering Andriy Burkov
- Kafka Neha Narkhede, Gwen Shapira and Todd Palino
Sources
As an Amazon Associate, Best AI Books earns from qualifying purchases. Best AI Books is sponsored by Iternal.ai, whose founder and CEO, John Byron Hanby IV, wrote The AI Strategy Blueprint, our #1 ranked book. How we rank books.






