AnalystPath

Tickets Filed on Weekends vs Weekdays

PandasMediumMid level~10 min

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.

tickets
ticket_idagent_idfiled_on
1102024-06-01
2102024-06-02
3112024-06-03
4122024-06-04
5122024-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 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