Case study: which support channel is fastest
From: Amara Okafor, Support Lead
"We're deciding which channel to push customers toward: chat, email or phone. My hunch is phone is fastest. Can you check last week's tickets in tickets.json? Some tickets are still open.
I care about the typical customer, not the one ticket that sat over a weekend."
Your answer: the channel to recommend, with the numbers behind it.
A case study starts from a question, not a task list. The steps take you from raw tickets to a recommendation, and the last step checks the answer itself.
The trap in this one is the average. A mean is pulled by a single long ticket, so a channel with one bad case can look slow even when it's fastest for nearly everyone. Amara says what she cares about, the typical customer, and that points to the median.
You'll use JSON loading, datetime parsing, grouping into a dictionary of lists, and the statistics module.
import statistics as st
hours = [0.5, 0.8, 1.2, 9.0, 0.6]
round(st.mean(hours), 2), st.median(hours)
Out: (2.42, 0.8). One 9-hour ticket triples the mean; the median ignores it.