AnalystPath

Same-Day Ticket Resolution Rate

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `tickets` loaded from `tickets.csv` with the columns `ticket_id` (the key), `user_id`, `opened_on` and `resolved_on`. Each row is one support ticket.

A ticket is **same-day** if it was resolved on the day it was opened (`resolved_on` equals `opened_on`). Return the percentage of same-day tickets across all tickets, rounded to 2 decimal places, in a single column named `same_day_pct`.

Example `tickets`:

```text
ticket_id user_id opened_on resolved_on
1 10 2024-01-05 2024-01-05
2 11 2024-01-06 2024-01-08
3 12 2024-01-07 2024-01-07
```

Expected result is `66.67`: two of the three tickets were resolved on the same day, so 2 / 3 = 66.67%.

Input data

Example rows — the live problem includes the full dataset.

tickets
ticket_iduser_idopened_onresolved_on
1102024-01-052024-01-05
2112024-01-062024-01-08
3122024-01-072024-01-07

Expected output

Your answer should return 1 row with the columns same_day_pct.

Starter code (Pandas (Python))

import pandas as pd

def same_day_rate(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