Python pandas — Chipotle Exercises
“There should be one—and preferably only one—obvious way to do it,” — Zen of Python. I certainly wish that were the case with pandas. In reading the docs it feels like there are a thousand ways to do each operation. And it is hard to tell if they do the exact same thing or which one you should use. That’s why I made An Opinionated Guide to pandas—to present you one consistent (and a bit opinionated) way of doing data science with pandas and cut out all the confusion and cruft.
In this video I work through the examples—cold! So, this should be entertaining for you.
I’ll talk about which methods I use, why I use them and most importantly tell you the stuff that I’ve never touched in my years of data science practice. If this sounds helpful to you then please watch and provide feedback in your comments.
This series is beginner-friendly but aimed most directly at intermediate users.
“Getting and Knowing – Chipotle” contents:
13:31. Step 14. This answer might be incorrect. Summing item_price fails to account for quantity. Perhaps a better solution was: revenue = (chipo.item_price * chipo.quantity).sum()
13:44. Step 15. Quantity of orders. This is an ambiguous question. Perhaps a better solution was count_unique_orders = chipo.order_id.nunique()
13:55. Step 16. Avg revenue/order. The two approaches above change the result, but obviously avg revenue/order = revenue/count_unique_orders.
An Opinionated Guide to pandas – Intro to Data Structures P1:
An Opinionated Guide to pandas – Intro to Data Structures P2:
An Opinionated Guide to pandas – Intro to Data Structures P3:
Link to GitHub repo including environment setup for tutorials:
Link to GitHub Intro To Data Structures Jupyter Notebook:
PEP 20 – The Zen of Python link: