Agents With a Dominant Contact Channel
Problem
You are given one DataFrame `support_logs` (loaded from `support_logs.csv`), one row per conversation, with columns `agent_id`, `ticket_ref`, and `channel` (such as 'email', 'phone', 'chat', or 'social'). Find the channel specialists: agents who handled at least 5 conversations and where at least 60% of those conversations came through a single channel. For each such agent return the `agent_id`, that leading channel as `top_channel`, and the share of their conversations on it as `channel_share` rounded to 2 decimals. Order by `channel_share` from highest to lowest, then by `agent_id` ascending.
Input data
Example rows — the live problem includes the full dataset.
| agent_id | ticket_ref | channel |
|---|---|---|
| 1 | 1001 | |
| 1 | 1002 | |
| 1 | 1003 | |
| 1 | 1004 | phone |
| 1 | 1005 |
Expected output
Your answer should return 2 rows with the columns agent_id, top_channel, channel_share.
Starter code (Pandas (Python))
import pandas as pd
def find_channel_specialists(support_logs) -> pd.DataFrame:
# Your code here
return support_logsSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock