Hi Reader!
Today’s tip is most useful if you already have some experience with pandas, which is the main data analysis library in Python.
If you’re brand new to pandas, I recommend starting here:
🔗 Easier data analysis with pandas (my free video series)
Let’s move on to today's tip!
In order to progress from pandas beginner to intermediate (and beyond), it’s important to build a mental model of what happens when you run your pandas code.
If you’re struggling to build that mental model, Pandas Tutor might be the perfect tool for you!
For example, if you input code like this:
dogs.groupby('size').mean()
Pandas Tutor outputs a diagram like this:
Interact with the live diagram
Or if you input more complex code like this:
titanic.groupby(['Embarked', 'Sex'])['Pclass'].mean().unstack()
Pandas Tutor outputs a multi-step diagram like this:
Interact with the live diagram
If you want to explore further, scroll to the bottom of Pandas Tutor and click on one of the many examples.
Once you’ve understood an example, I’d encourage you to change the code and/or the data, and see if the diagram changes in the way that you expect.
You can even paste in your own data! Just open up any CSV file, copy the top few rows (including the header), and paste them in place of the multi-line "csv" string:
Tidy Data Tutor is very similar, except it’s for R code and the Tidyverse.
Python Tutor was created by the same author, and it allows you to visualize Python, JavaScript, C, C++, and Java code.
nbtutor is a Jupyter Notebook extension for visualizing Python code within your notebook.
How helpful was today’s tip?
If you enjoyed this issue, please forward it to a friend! Takes only a few seconds, and it really helps me out 🙏
See you next Tuesday!
- Kevin
P.S. Whoa, you trained a neural net!
Did someone awesome forward you this email? Sign up here to receive data science tips every week!
Join 25,000+ intelligent readers and receive AI tips every Tuesday!
Hi Reader, I'm thrilled to announce that my new book, Master Machine Learning with scikit-learn, is now on sale! Buy from Amazon I poured my heart and soul into making this the highest quality and most practical Machine Learning book available. Publishing this book is a dream come true, and I'd be grateful if you'd consider picking up a copy! 🙏 Option 1: Get the paperback from Amazon ($19) Although most technical books of this size (300+ pages) tend to sell for at least $39, I've priced the...
Hi Reader, A few months ago, I announced that my new book, Master Machine Learning with scikit-learn, would be published in December. Since then, my personal life has undergone some dramatic changes 🥴 During the transition, it has been challenging to focus on anything other than bare life essentials 🍽️ 🛌 🚿 Thankfully, my life has begun to steady (yay!), and so in the past few weeks I've been able to wrap up some key pieces of the project! ✅ I'm thrilled to hold in my hands the FINAL proof...
Hi Reader, happy new year! 🎉 I wanted to share with you the three most important articles I found that look back at AI progress in 2025 and look forward at what is coming in 2026 and beyond. I’ve extracted the key points from each article, but if you have the time and interest, I’d encourage you to read the full articles! 💠 The Shape of AI: Jaggedness, Bottlenecks and Salients By Ethan Mollick “Jaggedness” describes the uneven abilities of AI: It’s superhuman in some areas and far below human...