PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick Overview

This question evaluates proficiency in data manipulation with pandas and SQL concepts, focusing on dataset merging, missing-value handling, and computing derived aggregate columns such as total_spent.

  • Medium
  • Boston Consulting Group
  • Data Manipulation (SQL/Python)
  • Data Scientist

Merge and Clean Customer Order Data for Analysis

Company: Boston Consulting Group

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Take-home Project

customers +----+---------+---------+ | id | name | country | +----+---------+---------+ | 1 | Alice | US | | 2 | Bob | UK | | 3 | Charlie | NULL | +----+---------+---------+ ​ orders +-----+-------------+--------+ | id | customer_id | amount | +-----+-------------+--------+ | 101 | 1 | 250.50 | | 102 | 2 | 99.99 | | 103 | 2 | NULL | +-----+-------------+--------+ ##### Scenario A retail company needs to combine customer and order datasets, clean nulls, and prepare the data for downstream analysis. ##### Question In Python/pandas, merge the two datasets on customer_id, keep all customers, and add a column total_spent that replaces NULL amounts with 0. Fill missing country values with the mode of existing countries. Return the resulting DataFrame sorted by total_spent descending. ##### Hints Use merge, fillna, and groupby/transform for the mode.

Quick Answer: This question evaluates proficiency in data manipulation with pandas and SQL concepts, focusing on dataset merging, missing-value handling, and computing derived aggregate columns such as total_spent.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Transform messy transactions with pandas - Boston Consulting Group (Medium)
  • Unify 7 tables and impute missing values - Boston Consulting Group (Medium)
  • Query top spenders and 7-day growth - Boston Consulting Group (Medium)
  • Manipulate and merge DataFrames correctly - Boston Consulting Group (Medium)
  • Transform and aggregate messy event data - Boston Consulting Group (Medium)