AnalystPath

Support Ticket Resolution Histogram

PandasEasyJunior level~10 min

Problem

A help desk wants a histogram of how long tickets took to resolve, grouped into four time buckets (minutes):

- `under 30` : less than 30 minutes
- `30 to under 60` : at least 30 and less than 60 minutes
- `60 to under 90` : at least 60 and less than 90 minutes
- `90 or more` : 90 minutes or more

DataFrame `tickets` (from `tickets.csv`) has columns `ticket_id` and `minutes`, where `minutes` is how long the ticket took to resolve.

Return a DataFrame with one row per bucket and columns `bucket` and `tickets`, where `tickets` is the number of tickets in that bucket. **Every bucket must appear even if its count is 0.** Rows may be returned in any order.

Input data

Example rows — the live problem includes the full dataset.

tickets
ticket_idminutes
120
225
328
445
5120

Expected output

Your answer should return 4 rows with the columns bucket, tickets.

Starter code (Pandas (Python))

import pandas as pd

def bucket_tickets(tickets) -> pd.DataFrame:
    # Your code here
    return tickets

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