AnalystPath

Top Issue Tags in a Support Queue

PandasMediumMid level~10 min

Problem

A DataFrame `supportnotes` logs help-desk replies. Each `note_body` contains exactly one square-bracketed tag, for example `[BILLING]` or `[LOGIN]`, marking the topic of the reply. Find the three most-used tags among notes written in March 2025 (note_date from 2025-03-01 to 2025-03-31 inclusive). Return a DataFrame with columns `issue_tag` (the tag text including its brackets, e.g. `[BILLING]`) and `tag_total` (how many March notes carried it), ordered by `tag_total` descending and then by `issue_tag` descending, keeping only the top three.

Input data

Example rows — the live problem includes the full dataset.

supportnotes
agent_idnote_idnote_datenote_body
5190012025-03-02Refund processed [BILLING]
5290022025-03-04Card declined again [BILLING]
5390032025-03-05Reset the password [LOGIN]
5490042025-03-07App keeps crashing [BUG]
5590052025-03-09Invoice mismatch [BILLING]

Expected output

Your answer should return 3 rows with the columns issue_tag, tag_total.

Starter code (Pandas (Python))

import pandas as pd

def top_issue_tags(supportnotes) -> pd.DataFrame:
    # Your code here
    return supportnotes

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