← Uber Interview Insights

Uber·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Uber data scientist interview with a pandas/stats coding question that looked straightforward on the surface but had a few moving parts. The DiD component was the real test, the type conversion and imputation were just setup.

Questions Asked (1)

Q1

You have a pandas DataFrame with columns for unit ID, group (treatment or control), period (pre or post), and an outcome variable stored as strings with exactly one missing value. Convert the outcome to integer, impute the missing value using the unconditional mean of non-missing values, then compute a difference-in-differences estimate of the treatment effect.

A/B Testing & ExperimentationProduct Analytics & MetricsAlgorithms & Data Structures
Author's notes

The string-to-int conversion and mean imputation parts I got through fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by cleaning the data: convert the outcome column to numeric, handling the single missing value by imputing it with the mean of non-missing values. Then compute the difference-in-differences estimate by calculating the change in outcomes for treatment and control groups and taking the difference of those changes. Finally, interpret the estimate as the causal effect of the treatment.

Pro tip: Always verify the parallel trends assumption before trusting a DiD estimate; if pre-period trends differ, the estimate may be biased. Also, consider clustering standard errors at the unit level to account for repeated observations.

1. Data Cleaning and Conversion

Convert the outcome column from strings to integers using pd.to_numeric, and identify the single missing value.

2. Imputation

Impute the missing value with the mean of the non-missing outcomes, ensuring you use only non-missing values for the calculation.

3. Compute Group Means

Calculate the average outcome for each group (treatment/control) and period (pre/post) combination.

4. Calculate DiD Estimate

Compute the difference in means for the treatment group (post - pre) minus the difference in means for the control group (post - pre).

5. Interpret and Validate

Interpret the DiD estimate as the treatment effect, and discuss assumptions like parallel trends and potential confounders.

Key Points to Mention

  • Difference-in-differences formula: (Y_treatment_post - Y_treatment_pre) - (Y_control_post - Y_control_pre)
  • Handling missing data: impute with unconditional mean of non-missing values
  • Data type conversion: ensure outcome is numeric for calculations
  • Parallel trends assumption: the treatment and control groups would have followed parallel trends in the absence of treatment
  • Standard errors: consider clustering at unit level for valid inference
  • Potential pitfalls: imputation may introduce bias, and DiD assumes no spillover effects

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