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, Here are your top AI stories for the week: ChatGPT can weaken your brain Claude shares nerve gas recipe Amsterdam ends AI experiment due to bias Read more below! 👇 Sponsored by: Brain.fm Transform Your Focus With Brain.fm I know you're always on the hunt for tools that genuinely improve your life—which is why I'm excited to introduce you to Brain.fm's groundbreaking focus music. Brain.fm's patented audio technology was recently validated in a top neuroscience journal, showing how...
Hi Reader, Last week, I invited you to help me test Google's Data Science Agent in Colab, which promises to automate your data analysis. Does it live up to that promise? Let's find out! 👇 Sponsored by: Morning Brew Business news you’ll actually enjoy Join 4M+ professionals who start their day with Morning Brew—a free daily newsletter that makes business, tech, and finance news genuinely enjoyable to read and hard to forget. Each morning, it breaks down complex stories in plain English—cutting...
Hi Reader, Today I'm trying something brand new! I wrote short summaries of the 5 most important AI stories this week, and also turned it into a video: Watch the video I'd love to know what you think! 💬 AI-generated TV ad airs during NBA finals Prediction market Kalshi just aired this AI-generated ad on network TV during the NBA finals. It was created in just two days by one person using Google's new Veo 3 video model, plus scripting help from Google's Gemini chatbot. Expect to see many more...