Heatmap of a Pivoted DataFrame
Brindle & Co records till transactions as one line each: the day, the hour, and the takings. The rota chart needs that long list rearranged into a grid with days down the side and hours across the top, and any day-and-hour combination nobody traded in shown as zero rather than as a hole. The rota meeting always opens with the same question: what did Monday at 9 do?
Task: Print the takings for day Mon at hour 9.
Input
The first line holds one integer n, the number of records, where 1 <= n <= 1000. Then come n lines, each holding a day name, an hour and an amount, separated by single spaces. Day names and hours contain no spaces, and no day-and-hour combination appears twice.
Output
One line holding the takings for Mon at hour 9, rounded to 2 decimal places. If nothing was recorded for that combination, print 0.00.
Example:
Input:
3
Mon 9 100
Mon 10 200
Tue 9 50
Output:
100.00
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in