Colour Tally
shirts has columns id and colour (text). Return a dictionary mapping each colour to the number of shirts with that colour (an int).
Example 1
shirts {"id":[1,2,3],"colour":["red","blue","red"]}
returns {"red":2,"blue":1}
red appears twice, blue once.
Constraints
- The tables are small
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Column StatisticsBeginner
- Column TotalBeginner
- Correlation of ColumnsBeginner
- Count Missing ValuesBeginner
- Count Repeated RowsBeginner
- Count Unique CitiesBeginner
- Count in RangeBeginner
- Drop Duplicate PairsBeginner