Data Transformation and Processing Logic Questions
Implementing transformation logic: joins, aggregations, deduplication, pivoting/reshaping, and business-rule application over datasets. Covers writing correct and maintainable transformation code, handling edge cases in the transform layer, and preparing data for downstream consumption. Focuses on the logic of turning raw data into analytics-ready outputs.
A dataset has missing values scattered across several columns. Walk through how you would decide what to do about each column's missingness, and how you would document and communicate that decision to stakeholders who will consume the resulting dashboard or model.
Given a table (or DataFrame) of user events with a timestamp, derive session boundaries: a new session starts whenever the gap between consecutive events for the same user exceeds a configured timeout. Implement this both in SQL (using LAG/window functions and a running sum to assign session ids) and in pandas (as a reusable function), and return session id, start, end, and event count per session. Discuss how you handle unsorted input and timezone-aware timestamps.
Given a table of per-user transactions (amount, timestamp), write a SQL query using window functions that flags an outlier transaction as one where the amount exceeds the user's own historical mean plus 3 standard deviations, computed over a trailing period (e.g. the past 365 days). Explain how you handle a user with fewer than 2 prior transactions, and discuss why a simple z-score threshold can miss an outlier that a robust method like IQR would catch, since the outlier itself inflates the standard deviation used to judge it.
Given a free-text address field with inconsistent layouts across countries, describe a strategy to parse and canonicalize it into structured components (street, city, region, postal code, country) suitable for matching and analytics, including how you would handle a case your approach can't confidently resolve. As a smaller related exercise, implement a general text-normalization function that trims whitespace, collapses repeated internal whitespace, strips control characters, and preserves Unicode letters and emoji.
Some aggregations (sum, count) are associative and trivially parallelizable across a distributed dataset with a guaranteed deterministic result. Others, like median or percentile, are not. Discuss how you would compute an approximate percentile at scale with a mergeable, deterministic algorithm (for example a t-digest or histogram sketch), and separately, how you would implement a scalable approximate 'distinct count' (for example unique users in the last 30 days) using a structure like HyperLogLog, including the accuracy/memory trade-off of each.
Unlock Full Question Bank
Get access to all 42 Data Transformation and Processing Logic interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.