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+ aspiring Data Scientists and receive Python & Data Science tips every Tuesday!
Hi Reader, Next week, Iβll be offering a Black Friday sale on ALL of my courses. Iβll send you the details this Thursday! π¨ π Tip #50: What is a "method" in Python? In Python, a method is a function that can be used on an object because of the object's type. For example, if you create a Python list, the "append" method can be used on that list. All lists have an "append" method simply because they are lists: If you create a Python string, the "upper" method can be used on that string simply...
Hi Reader, I appreciate everyone who has emailed to check on me and my family post-Helene! It has been more than 6 weeks since the hurricane, and most homes in Asheville (mine included) still don't have clean, running water. We're hopeful that water service will return within the next month. In the meantime, we're grateful for all of the aid agencies providing free bottled water, free meals, places to shower, and so much more. β€οΈ Thanks for allowing me to share a bit of my personal life with...
Hi Reader, Regardless of whether you enrolled, thanks for sticking with me through the launch of my new course! π I've already started exploring topics for the next course... π π Link of the week git cheat sheet (PDF) A well-organized and highly readable cheat sheet from Julia Evans, the brilliant mind behind Wizard Zines! π Tip #48: Three ways to set your environment variables in Python I was playing around with Mistral LLM this weekend (via LangChain in Python), and I needed to set an...