← Boston Consulting Group Interview Insights
This took me longer to mentally parse than I expected.
Start by profiling both DataFrames to understand the messy currency strings, misaligned columns, and mixed schemas, then use vectorized pandas operations to standardize currencies, align columns, and merge on user_id. After merging, filter to the target date, compute the required per-country and per-plan metrics using groupby aggregations, and return a sorted tidy DataFrame while explicitly stating assumptions about nulls and timezones.
Pro tip: Demonstrate maturity by explicitly stating your assumptions about nulls and timezones upfront, and show how you would validate the cleaned data (e.g., check for unexpected nulls or currency conversion errors) before computing metrics.
Examine both DataFrames to identify messy currency formats, misaligned columns, mixed schemas, and potential nulls. Check dtypes, unique values, and sample rows to plan cleaning steps.
Use vectorized string methods to parse currency strings into numeric values, handle nulls appropriately, and align columns between the two DataFrames. Ensure consistent data types and handle timezone conversion if needed.
Merge the cleaned user and event DataFrames on the appropriate keys (e.g., user_id) using a vectorized merge. Filter events to the specific target date, being explicit about timezone handling.
Use groupby aggregations to compute distinct active users, purchasers, purchase counts, and revenue per country and plan. Ensure no loops are used—rely on pandas built-in functions like nunique, sum, and count.
Return a sorted tidy DataFrame with clear column names. Validate results by checking for anomalies, and document assumptions about nulls (e.g., dropped or imputed) and timezones (e.g., UTC).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.