AnalystPath

Agents With a Dominant Contact Channel

PandasMediumMid level~10 min

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.

support_logs
agent_idticket_refchannel
11001email
11002email
11003email
11004phone
11005email

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_logs

Solve 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

Related Pandas questions