Path: blob/main/extensions/copilot/test/scenarios/test-notebooks/Chipotle.solution.ipynb
13397 views
Kernel: .venv
Ex2 - Getting and Knowing your Data
Check out Chipotle Exercises Video Tutorial to watch a data scientist go through the exercises
This time we are going to pull data directly from the internet. Special thanks to: https://github.com/justmarkham for sharing the dataset and materials.
Step 1. Import the necessary libraries
In [56]:
Step 2. Import the dataset from this address.
Step 3. Assign it to a variable called chipo.
In [57]:
Step 4. See the first 10 entries
In [58]:
Out[58]:
Step 5. What is the number of observations in the dataset?
In [59]:
Out[59]:
4622
Step 6. What is the number of columns in the dataset?
In [60]:
Out[60]:
5
Step 7. Print the name of all the columns.
In [61]:
Out[61]:
Index(['order_id', 'quantity', 'item_name', 'choice_description',
'item_price'],
dtype='object')
Step 8. How is the dataset indexed?
In [62]:
Out[62]:
RangeIndex(start=0, stop=4622, step=1)
Step 9. Which was the most-ordered item?
In [63]:
Out[63]:
Step 10. For the most-ordered item, how many items were ordered?
In [64]:
Out[64]:
Step 11. What was the most ordered item in the choice_description column?
In [65]:
Out[65]:
Step 12. How many items were orderd in total?
In [66]:
Out[66]:
4972
Step 13. Turn the item price into a float
Step 13.a. Check the item price type
In [67]:
Out[67]:
dtype('O')
Step 13.b. Create a lambda function and change the type of item price, then print the item price type
In [68]:
(Output Hidden)
Step 13.c. Check the item price type
In [69]:
Out[69]:
dtype('float64')
Step 14. How much was the revenue for the period in the dataset?
In [70]:
Out[70]:
Revenue was: $39237.02
Step 15. How many orders were made in the period?
In [71]:
Out[71]:
1834
Step 16. What is the average revenue amount per order?
In [72]:
Out[72]:
21.39423118865867
Step 17. How many different items are sold?
In [73]:
Out[73]:
50