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: Exercise 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. Helpful links: An Opinionated Guide to pandas – Intro to Data Structures P1: https://www.youtube.com/watch?v=HKVsVksViXo&feature=youtu.be An Opinionated Guide to pandas – Intro to Data Structures P2: https://www.youtube.com/watch?v=KB-19V-cSs4&feature=youtu.be An Opinionated Guide to pandas – Intro to Data Structures P3: https://www.youtube.com/watch?v=Z6RU_MFjevU&feature=youtu.be Link to GitHub repo including environment setup for tutorials: https://github.com/knathanieltucker/pandas-tutorial Link to GitHub Intro To Data Structures Jupyter Notebook: https://github.com/knathanieltucker/pandas-tutorial/blob/master/notebooks/Pandas%20Intro%20to%20Data%20Structures.ipynb PEP 20 – The Zen of Python link: https://www.python.org/dev/peps/pep-0020/
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.