Tickets Filed on Weekends vs Weekdays
Problem
A support desk logs every ticket in the DataFrame `tickets` (loaded from `tickets.csv`) with columns `(ticket_id, agent_id, filed_on)` where `filed_on` is a date string.
Report two numbers across the whole DataFrame: `weekend_count`, the number of tickets filed on a Saturday or Sunday, and `weekday_count`, the number filed Monday through Friday. The output is a single row with those two columns.
Input data
Example rows — the live problem includes the full dataset.
| ticket_id | agent_id | filed_on |
|---|---|---|
| 1 | 10 | 2024-06-01 |
| 2 | 10 | 2024-06-02 |
| 3 | 11 | 2024-06-03 |
| 4 | 12 | 2024-06-04 |
| 5 | 12 | 2024-06-07 |
Expected output
Your answer should return 1 row with the columns weekend_count, weekday_count.
Starter code (Pandas (Python))
import pandas as pd
def tickets_weekend_vs_weekday(tickets) -> pd.DataFrame:
# Your code here
return ticketsSolve 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