AnalystPath

DoorDash Average Earnings per Weekday

PandasMediumMid levelDoorDash~15 min

Problem

**[Asked at DoorDash]**

For each weekday (Monday, Tuesday, ...), compute the average delivery earnings.

Return `weekday` and `avg_earnings` (rounded to 2 dp), ordered by avg_earnings
descending.

Input data

Example rows — the live problem includes the full dataset.

deliveries
delivery_iddriver_iddelivery_timeearnings
11012023-01-02 09:0015.0
21012023-01-02 18:0025.0
31022023-01-03 09:0012.0
41022023-01-09 09:0018.0
51032023-01-09 19:0030.0

Expected output

Your answer should return 2 rows with the columns weekday, avg_earnings.

Starter code (Pandas (Python))

import pandas as pd

def avg_earnings(deliveries: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return deliveries

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