AnalystPath

Uber Revenue Loss from Cancellations

PandasHardSenior levelUber~15 min

Problem

**[Asked at Uber]**

Calculate completed revenue, lost revenue (from cancelled orders), and the
**loss percentage** (cancelled / total) rounded to 2 dp.

Return a single row with `completed_revenue`, `lost_revenue`, `loss_pct`.

Input data

Example rows — the live problem includes the full dataset.

orders
order_idfarestatus
115.50completed
225.00completed
318.00cancelled
422.50completed
530.00cancelled

Expected output

Your answer should return 1 row with the columns completed_revenue, lost_revenue, loss_pct.

Starter code (Pandas (Python))

import pandas as pd

def revenue_loss(orders: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return orders

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