← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Uber Applied Scientist interview with a pandas-heavy data analysis question involving multiple joined DataFrames and aggregation. The problem felt straightforward on the surface but the expected depth around join types, NaN handling, and output validation made it a real test.

Questions Asked (1)

Q1

You're given three related DataFrames (e.g., orders, items, restaurants) joined by appropriate keys. Use pandas groupby and aggregation to answer business questions like average sales per category, which categories drive the most revenue, and per-restaurant metrics like order completion rate and average basket size. Walk through your join strategy, aggregation approach, and how you'd validate the result.

Product Analytics & MetricsData ModelingTechnical Trade-offs
Author's notes

This one took more thought than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the business questions and the grain of each DataFrame, then plan the join strategy to avoid row explosion or loss. Use pandas merge with validate to ensure correct cardinality, and groupby with named aggregations to compute metrics. Validate results by cross-checking totals, spot-checking edge cases, and ensuring no data loss or duplication.

Pro tip: Always validate your joins by checking row counts before and after, and use merge's validate parameter to catch unexpected duplicates. Also, consider the business context: for example, order completion rate might require filtering to only completed orders, and average basket size might need to exclude cancelled orders.

1. Clarify business questions and data grain

Identify the specific metrics needed (e.g., average sales per category, revenue by category, per-restaurant completion rate, average basket size) and understand the grain of each DataFrame (e.g., orders at order level, items at item level).

2. Plan and execute joins

Determine the join keys and order (e.g., orders to items on order_id, then to restaurants on restaurant_id). Use merge with validate='one_to_many' or similar to ensure correct cardinality and avoid duplication.

3. Aggregate with groupby

Use groupby on the appropriate dimensions (e.g., category, restaurant_id) and apply aggregations like sum, mean, count, and custom functions for rates. Use named aggregation for clarity.

4. Compute derived metrics

Calculate metrics like order completion rate (completed orders / total orders) and average basket size (total sales / number of orders) using the aggregated data, ensuring correct denominators.

5. Validate results

Cross-check totals against raw data, spot-check specific groups, and ensure no data loss or duplication. Use sanity checks like sum of category revenue equals total revenue.

Key Points to Mention

  • Join strategy: use merge with validate to ensure correct cardinality and avoid row explosion.
  • Handling missing data: decide whether to drop or fill NaNs based on business context.
  • Aggregation functions: use groupby with agg for multiple metrics, and named aggregation for readability.
  • Derived metrics: compute rates and averages carefully, ensuring correct denominators (e.g., only completed orders for completion rate).
  • Validation: check row counts, cross-total with raw data, and spot-check edge cases.
  • Performance considerations: for large data, consider using categorical dtypes or efficient groupby operations.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.