Notebooks and solutions for Pandas Workout, my book of 200 exercises for becoming fluent in Pandas.
Reading about Pandas teaches you what groupby does. It doesn't give you the
reflex to reach for it at the moment you need it. That only comes from writing
enough Pandas that the syntax stops being the hard part, and you can spend your
attention on the question you are actually asking of the data.
One directory per chapter. Each exercise has two notebooks:
Exercise NN — Title.ipynb— the exercise and my solution, with an explanation of why the solution works the way it does.Exercise NNb — Beyond the exercise.ipynb— the follow-up questions, for when you want to push a bit harder on the same data.
Chapters 8 and 13 are projects rather than exercise sets: longer problems that pull together everything up to that point.
The exercises work on real data sets, which live outside this repository because of their size:
https://files.lerner.co.il/pandas-workout-data.zip
Heads up: that download is about 865 MB. Unzip it wherever you like, then adjust the paths at the top of each notebook to point at it.
With uv:
uv add pandas jupyter
uv run jupyter notebook
Or with pip, if that is what you already have set up:
pip install pandas jupyter
jupyter notebook
JupyterLab works just as well, if you prefer it. Any recent version of Pandas will do; where an exercise depends on behavior that changed between versions, the notebook says so.
- Manning — print and ebook, including access to liveBook
- Amazon
- O'Reilly — included with a Learning Platform subscription
If the book helped you, an Amazon review genuinely does more for it than anything else you could do.
Two hundred exercises is a lot, and it still ends. If you want to keep going:
- Bamboo Weekly — a new Pandas problem every week, built on real public data. Two of each week's questions and answers are free, as are hundreds of problems in the archive.
- Better Developers — a free Python article in your inbox every week.
- Python Workout — the same treatment for Python itself, if your Python needs the same work.
- LernerPython — my courses, live sessions, and office hours.
Questions, corrections, or a solution you like better than mine? reuven@lernerpython.com — I read everything.