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.
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.
Given a table with a text column that may be NULL, an empty string, or contain only whitespace, write a SQL query to find all three cases and then normalize them to a single canonical representation (NULL) so that downstream logic treats them consistently. Note any caveats that differ across SQL dialects.
Design and implement a streaming deduplication component that consumes a stream of (id, timestamp) events and reports whether each event is new or a duplicate within a bounded time window, using bounded memory (an LRU cache or a Bloom filter, your choice). Discuss the correctness trade-off of the approach you chose: can it produce false positives or false negatives, and what does that mean for events that get silently dropped or double-counted?
You must deduplicate a dataset with billions of records spread across many files in object storage; it does not fit into a single machine's memory. Describe (pseudocode is fine) an out-of-core approach using external sorting or hash-partitioning with spill-to-disk, and explain how you would parallelize it across machines or cores while bounding memory use per worker.
Discuss the options for parallelizing a CPU-bound data transformation in Python: threading, multiprocessing, vectorized numpy/pandas operations, and moving to a distributed framework like Dask or Spark. Explain why Python's GIL limits threading for CPU-bound work, and the practical costs (serialization overhead, memory duplication) of multiprocessing. Provide a small code sketch of a multiprocessing-based approach that preserves input order in its output.
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.