* These short exercises involve a combination of filtering, aggregating and joining data to test your knowledge.
* This is also a chance to make sure your notebook environment is working properly!
* Discuss in your group the different ways you could accomplish these tasks, and enter your answers as a group in the flux poll here: https://flux.qa/DSMGW7
* Take your time, and feel free to research/consult last semester's notes.
%% Cell type:code id:3f6fb082 tags:
``` python
importpandasaspd
# This dataframe represents a list of transactions from a very strange
# low-value auction. (I know, I'm not very creative).
sold_items=pd.DataFrame({
"sale_id":[1,2,3,4,5,6,7,8,9,10],
"type":[
"book","photo","book","pen","book",
"pen","pen","book","pen","pen"
],
"price":[
10,5,9,1,7,0.9,0.5,15,1.2,0.5,
]
})
sold_items
```
%%%% Output: execute_result
sale_id type price
0 1 book 10.0
1 2 photo 5.0
2 3 book 9.0
3 4 pen 1.0
4 5 book 7.0
5 6 pen 0.9
6 7 pen 0.5
7 8 book 15.0
8 9 pen 1.2
9 10 pen 0.5
%% Cell type:markdown id:8bcebc54 tags:
Q1. Find a single line of code to count the number of items of each type (books, pens, photos) sold.