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.
You are using a Bloom filter to probabilistically deduplicate a high-volume stream. Given an expected number of unique keys N and an acceptable false-positive rate p, derive (or state and apply) the formulas for the bit-array size and the number of hash functions, and explain the operational consequence of a false positive here: does it silently drop a genuinely new record, or does it silently merge two distinct records? Also discuss what happens when two different keys hash to the same underlying bits (a collision) in a deterministic hash-based dedup scheme instead.
Implement a defensive type-casting utility that attempts to cast a column (or Series) to a target type, returning both the successfully cast values and the indices that failed to cast, rather than raising an exception or silently producing bad data. Discuss common pitfalls of casting strings to numbers or dates in real-world data, and how your function behaves on an empty input or an input where every value fails to cast.
A stakeholder reports that joining two tables produced more rows than either input table (for example, 10,000 orders joined to 200 refunds produced 10,500 result rows). Walk through how you would debug this: what you would check first, what a sample query would look for, and how you would explain the root cause (and the fix) in plain language to a non-technical stakeholder. Separately, describe how you would resolve it when the two tables also share a column name (like id or created_at) that means something different in each source.
Implement a reusable data-cleaning function that imputes missing values in a DataFrame: numeric columns filled with the column median, categorical columns filled with the mode (or a placeholder), with a configurable strategy per column type. The function should preserve original dtypes, not mutate the input in place, handle an empty DataFrame and a column that is entirely missing without raising an exception, and optionally add a boolean '<column>_imputed' flag so downstream consumers can tell which values were real versus imputed. Discuss how you would adapt this to a dataset too large to fit in memory.
During feature or dataset preparation for a supervised model, a join can accidentally introduce label leakage: for example, joining in a table that contains information only available after the outcome is known, or a join that looks ahead in time. Describe common sources of this kind of leakage, how you would detect it automatically, and how you would design a rollback or re-computation process once leakage is found.
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.