Data Science from Scratch: First Principles with Python, 2nd Edition

Master data science by building algorithms from scratch with Python. This 2nd edition covers linear algebra, machine learning, and neural networks—no black boxes, just real understanding.

Want to preview before you buy? Click Request Free Sample and tell us which chapter or pages you’d like to see, along with your email address. We’ll send you those pages from the eBook so you can be sure it’s the right one before buying.

What You Get
  • Instant download & lifetime access Available as soon as your payment is confirmed. Your download link is also sent to the email address you provide at checkout, and you can download your purchased eBook anytime from My Account → Downloads with unlimited downloads. An account is created automatically using the same email address.
  • Own your eBook Receive the available PDF/EPUB file directly after purchase. No rental or temporary access — download and keep your eBook for personal use with lifetime access.
  • Full refund guarantee If the eBook you receive does not match the details and description provided on the product page, contact [email protected] and we’ll issue a full refund within 24 hours.
  • Secure payment through PayPal Pay securely by debit or credit card or with your PayPal account. Your card details are processed by PayPal and are never stored on our site.
eBook Details
Author Joel Grus
ISBN-13 9781492041139
Published 2019
Format Digital Download (PDF/EPUB)
Language English
Publisher O’Reilly Media
ISBN-10 1492041130
Edition Second Edition
File Size 10.0 MB
Pages 398

$20.00$37.00

About This Book

The Challenge It Addresses

Most data science courses and libraries treat algorithms as black boxes. You call sklearn.linear_model.LogisticRegression without understanding the math behind gradient descent or the assumptions of logistic regression. This dependency on abstractions leaves you unable to debug models, adapt them to novel problems, or explain your reasoning to stakeholders. Data Science from Scratch eliminates that gap by teaching you to build every algorithm from first principles—using only Python and basic math.

After working through this book, you won’t just know how to call a library; you’ll understand why the algorithm works, when it fails, and how to modify it when your data doesn’t fit the textbook case.

About Data Science from Scratch: First Principles with Python, 2nd Edition

Data Science from Scratch: First Principles with Python (2nd Edition, 2019) is a hands-on guide that teaches data science fundamentals by implementing core algorithms from scratch. Written by Joel Grus and published by O’Reilly Media, this edition is fully updated for Python 3.6 and covers the entire data science pipeline—from data collection and cleaning to machine learning and visualization.

The book eschews external libraries like scikit-learn and pandas in its early chapters, forcing you to write linear algebra, statistics, probability, and machine learning models yourself. Later chapters introduce these libraries for practical use, but only after you’ve built the underlying concepts. This approach builds deep, transferable knowledge that empowers you to innovate rather than imitate.

Is This Book Right for You?

This book is ideal for developers, software engineers, and aspiring data scientists who have basic Python proficiency and want to understand the inner workings of data science. It’s also valuable for analysts transitioning into machine learning roles who need to go beyond point-and-click tools.

If you’re a student in a data science bootcamp or a self-taught practitioner who feels like you’re only memorizing library calls, this book will fill the gaps in your understanding. It’s not for absolute beginners to programming—you should know Python syntax and basic functions—but it assumes no prior knowledge of statistics or machine learning.

Key Takeaways

  • How to implement linear algebra operations (vectors, matrices, matrix multiplication) from scratch using Python lists
  • Foundations of descriptive and inferential statistics, including probability distributions, Bayes’ theorem, and hypothesis testing
  • Gradient descent—the engine behind most modern machine learning—and how to code it from scratch to optimize any cost function
  • Decision trees, random forests, and the bias-variance tradeoff, built step by step without external libraries
  • Neural networks from scratch, including backpropagation and activation functions, to understand deep learning basics
  • Clustering algorithms (k-means, hierarchical) and dimensionality reduction (PCA) with raw Python implementations
  • Natural language processing techniques like Naive Bayes classification and sentiment analysis, written from the ground up

Why This Book Stands Out

Most data science books (e.g., Python Machine Learning by Sebastian Raschka, Hands-On Machine Learning by Aurélien Géron) focus on applying libraries like scikit-learn and TensorFlow. While those are excellent for production work, they leave you dependent on the library’s abstractions. Data Science from Scratch takes the opposite approach: it builds the algorithm first, then shows you the library shortcut. This creates a deeper understanding that alternative resources rarely provide.

For example, where other books show you how to call LogisticRegression().fit(), Grus walks you through the math of likelihood, the log-odds transformation, and the gradient descent update rule—then has you write the code yourself. The result is a developer who can debug, customize, and extend models rather than just apply them.

Additionally, the second edition includes a new chapter on deep learning and updated examples for Python 3.6, making it current with modern practices. No other book at this price point teaches both the theory and the raw implementation in such a accessible, project-driven way.

Who Wrote This Book

Joel Grus is a seasoned data scientist and engineer who has worked at Google, Allen Institute for Artificial Intelligence, and other leading tech organizations. He is known for his clear, engaging teaching style and for writing one of the most popular data science books on the market. His expertise ensures that the explanations are not only accurate but also practical—drawn from real-world experience.

O’Reilly Media is the gold standard for technical publishing. With decades of experience curating content from world-class practitioners, O’Reilly guarantees that Data Science from Scratch meets the highest editorial and technical standards. This combination of author and publisher gives you confidence that every algorithm, code snippet, and explanation is reliable and up to date.

Final Assessment

Absolutely. If you want to truly understand data science rather than just memorize library calls, this book is the best investment you can make. It’s not a quick reference—it’s a deep learning experience that will change how you approach problems. The second edition’s updates keep it relevant for today’s Python ecosystem, and the hands-on approach ensures you retain what you learn.

Whether you’re preparing for a data science interview, building a personal project, or transitioning into a new role, the foundational knowledge you gain from this book will pay dividends throughout your career. It’s the difference between being a tool user and a tool builder.

Download Data Science from Scratch: First Principles with Python, 2nd Edition Now

Stop relying on black boxes and start understanding the algorithms that power modern AI. Data Science from Scratch: First Principles with Python (2nd Edition, O’Reilly Media, 2019) gives you the deep, transferable knowledge that separates elite data scientists from the rest. Whether you’re a software engineer, a student, or a professional looking to upskill, this book is your roadmap to genuine mastery.

Add to cart now and start building your own algorithms from scratch. The current edition is in stock, and the demand for data science skills has never been higher—don’t let another day pass without closing the gap between theory and practice.