Python Mock Interview for Data Engineering

250+ Python questions focused on data manipulation, ETL logic, and file parsing. Your code actually runs with pandas, numpy, and the full standard library. AI evaluation reviews correctness, code quality, edge case handling, and Pythonic patterns.

250+
Python Questions
Your code runs
Real Execution
pandas, numpy, stdlib
Libraries Available
22 min
Avg. Solve Time

Why Data Engineering Python Interviews Are Nothing Like LeetCode

No LeetCode algorithms

If you have been grinding LeetCode to prepare for a data engineering Python round, you are studying the wrong material. DE Python interviews do not test binary search, dynamic programming, or graph traversal. They test whether you can clean a messy CSV, call a paginated API, and write an ETL function that handles errors without crashing. The skillset overlap between LeetCode and DE Python interviews is roughly 15%.

Real-world messiness is the test

SWE interviews give you clean, well-defined inputs. DE interviews give you a JSON file where some records are missing fields, some dates are in ISO format and others are in US format, and one value is the string 'null' instead of actual null. The test is not whether you can write the algorithm. The test is whether you can handle the mess. DataDriven's Python questions replicate this messiness with intentionally dirty test data.

Error handling is scored, not optional

In a SWE interview, you might mention error handling and move on. In a DE interview, the interviewer asks: what happens when this API returns a 500? What happens when the file is empty? What happens when a field is missing? You are expected to write the try/except blocks, implement retry logic, and log the error with enough context to debug at 3am. DataDriven's evaluator explicitly checks for error handling in every Python question.

Your code runs for real, not in a toy environment

DataDriven executes your Python code in a real environment with pandas, numpy, and the full standard library. This matters because it means your imports work, your file I/O works, and your code runs the same way it would in a real pipeline environment. Platforms that simulate Python execution or restrict imports do not prepare you for the actual tools you will use.

Data Engineering vs Software Engineering Python Interviews

DimensionData EngineeringSoftware Engineering
Problem typeData transformation, ETL, file processing, API extractionAlgorithms, data structures, system design
Core skill testedHandling messy data, edge cases, idempotency, resilienceTime/space complexity, algorithm selection, OOP design
Code evaluationDoes it produce correct output from messy input? Is it maintainable?Does it pass all test cases? What is the Big O?
Libraries expectedpandas, json, csv, requests, datetime, os, reStandard library only (no external packages)
Error handling emphasisCritical. Pipelines run unattended. Errors must be caught and logged.Moderate. Focus is on correctness, not operational resilience.
Typical questionParse a log file, extract timestamps, find sessions with gaps > 30minFind the shortest path in a weighted graph using Dijkstra's

What Python Topics Interviewers Test for Data Engineers

Data Manipulation (40%)

Transforming, cleaning, reshaping, and validating data. This is the core of what data engineers do with Python, and it is the core of what interviewers test. Questions involve parsing messy inputs, handling missing values, deduplication, type conversion, and restructuring nested data into flat formats. Patterns: Flatten nested JSON into tabular rows; Deduplicate records using a composite key with tiebreaker logic; Validate data against a schema and collect all violations (not just the first); Convert between data formats: CSV to JSON, JSON to Parquet, XML to dicts; Handle mixed types in a column (strings that should be integers, dates in 4 different formats). Why it matters: Data manipulation is 40% of questions because it is 80% of the actual job. Every pipeline starts with messy input data. Interviewers want to see that you can handle the mess without breaking, and that your code is readable enough for the next engineer to maintain.

ETL Logic (25%)

Building extract-transform-load workflows in Python. Questions test your ability to design a pipeline that reads from a source, applies transformations in the correct order, handles errors gracefully, and writes to a destination. The focus is on correctness and resilience, not speed. Patterns: Build a pipeline that retries failed API calls with exponential backoff; Implement idempotent writes: running the pipeline twice produces the same result; Process a large file in chunks to stay within memory limits; Handle late-arriving data by merging it into existing results; Log every transformation step for debugging and auditability. Why it matters: ETL questions separate data engineers from Python developers. A Python developer writes code that works once. A data engineer writes code that works at 3am when the source system sends a file with a new column, a missing header, and timestamps in a different timezone.

File Parsing (15%)

Reading and processing CSV, JSON, Parquet, XML, and log files. These questions test your knowledge of Python's I/O libraries, encoding handling, and your ability to deal with malformed input. Real-world data files are never clean, and interviewers know this. Patterns: Parse a CSV with inconsistent quoting and embedded newlines; Read a multi-gigabyte JSON file line by line (JSONL format) without loading it all into memory; Extract structured data from semi-structured log files using regex; Handle UTF-8 encoding errors gracefully (skip, replace, or report); Process a ZIP archive containing multiple CSVs with different schemas. Why it matters: File parsing is a litmus test for production experience. Candidates who have only worked with clean DataFrames struggle with encoding issues, malformed rows, and memory constraints. Interviewers use file parsing questions to find engineers who have debugged real pipelines.

API Handling (10%)

Extracting data from REST APIs with pagination, rate limiting, authentication, and error handling. These questions combine HTTP knowledge with data engineering patterns like incremental extraction and checkpoint management. Patterns: Paginate through an API that uses cursor-based pagination; Implement rate limiting with a token bucket or simple sleep; Handle API errors: retry on 429 and 500, fail on 400 and 403; Extract data incrementally using a high-water mark timestamp; Authenticate with OAuth2 and refresh expired tokens. Why it matters: APIs are the extraction layer of most modern pipelines. Interviewers test whether you can write reliable extraction code that does not crash when the API returns unexpected responses, and that does not get your company's API key revoked by ignoring rate limits.

Pandas (10%)

DataFrame operations: merge, groupby, pivot, melt, apply, and vectorized operations. Pandas questions test whether you can write efficient tabular transformations without falling back to row-by-row iteration. Patterns: Group by multiple columns and compute multiple aggregations in one pass; Merge DataFrames with different column names and handle duplicates; Pivot long data to wide format and fill missing combinations; Replace iterrows() loops with vectorized operations for 100x speedup; Handle categorical data, datetime parsing, and memory optimization with dtypes. Why it matters: Pandas is a polarizing topic. Some DE teams use it heavily; others prefer pure Python or PySpark. When it does appear, interviewers specifically test vectorized thinking. Writing a for loop over DataFrame rows is a red flag that tells the interviewer you do not understand how pandas actually works under the hood.

What the AI Evaluator Reviews on Every Python Question

Correctness

Your code runs against test inputs that include happy path data and edge cases: empty inputs, single-element lists, None values, mixed types, and extremely large inputs. Results are compared against expected output, and you see exactly which cases passed and which failed.

Edge case handling

Does your code handle None/NaN values? What happens with an empty input file? What about malformed rows in a CSV? The evaluator checks whether your code fails gracefully or crashes. It also checks whether you handle edge cases by design (defensive coding) or by accident (getting lucky on the test data).

Code quality

Variable naming, function decomposition, DRY principle, appropriate use of Python idioms. The evaluator flags long functions that should be split, repeated code blocks that could be loops, and non-descriptive variable names. This maps directly to the 'code quality' axis on interview rubrics.

Pythonic patterns

List comprehensions vs verbose loops. Context managers for file handling. Generator expressions for memory efficiency. enumerate() instead of manual index tracking. The evaluator identifies places where idiomatic Python would improve your code and explains why.

Performance

O(n^2) loops from nested list operations. Unnecessary copies of large DataFrames. Reading entire files into memory when streaming would work. The evaluator reviews your approach and flags solutions that would fail on production-scale data.

5 Tactics That Improve Your Python Interview Score

Start with the input/output contract

Before writing any code, explicitly define: What is the input type and shape? What is the expected output type and shape? What are the edge cases? Writing this as a docstring or comment before coding shows the interviewer you think before you type. It also prevents the most common mistake: writing 80% of the solution before realizing you misunderstood the output format.

Write small functions, not one giant block

Interviewers evaluate code organization. A single 60-line function that parses, transforms, validates, and writes data is hard to read and hard to score. Break it into 4 functions of 15 lines each. Name them clearly: parse_input, transform_records, validate_output, write_results. This structure also makes it easier to test and debug during the interview.

Handle errors explicitly, not silently

A bare except: pass is worse than no error handling at all. It tells the interviewer you are hiding bugs. Instead, catch specific exceptions, log useful context (which file, which row, what the bad value was), and decide whether to skip the bad record or abort the pipeline. DataDriven's evaluator specifically checks for bare except blocks and awards points for targeted exception handling.

Think about memory from the start

If the question mentions 'large file' or 'millions of records,' the interviewer is testing whether you will load everything into memory. Use generators, process in chunks, or stream line by line. Saying 'I would use a generator here because the file might not fit in memory' is worth points even if the test data is small.

Test with edge cases before submitting

Run your code mentally (or actually, on DataDriven) with: empty input, single record, None values, duplicate keys, and the largest input you can imagine. If your code handles all five, you have covered 90% of what the evaluator checks. This habit also impresses interviewers because it shows you think about failure modes proactively.

How Code Execution Works

When you submit Python code on DataDriven, it does not run in a simulated environment or a restricted interpreter. It runs for real, the same way your production pipelines would execute. Each submission starts with a clean slate, so there is no state leakage between questions.

You have access to pandas, numpy, and the full Python standard library. You can use json, csv, re, datetime, collections, itertools, functools, os.path, io, and every other stdlib module. File I/O works: you can read input files and write output files. Test data is pre-loaded and ready for your code to process.

Execution has a generous timeout and memory allowance for interview questions, but infinite loops and memory bombs are caught. If your code exceeds a limit, you get a clear error message explaining what happened. This matches the constraints you would face in a real interview environment.

The evaluator checks your code across a range of edge cases. If your code throws an exception, you see the full traceback so you can debug and resubmit. This is exactly the feedback loop you need to build interview-ready habits.

Prepare for the interview
01 / Open invite
02min.

Know the patterns before the interviewer asks them.

a Python query, the same shape a screen would give you.
The diff against expected. Where ties broke. What you missed.
sandbox
1def sessionize(events):
2 sessions = []
3 for e in events:
4 if gap_minutes(e) > 30:
5
Execute your solution0.4s avg.
ShopifyInterview question
Solve a problem

Frequently Asked Questions

How is a Python interview for data engineering different from a Python SWE interview?+
DE Python interviews focus on data transformation, ETL logic, file parsing, and API handling. SWE interviews focus on algorithms, data structures, and system design. The overlap is about 15%. Preparing with LeetCode alone leaves you unprepared for 85% of what DE interviewers actually test.
What libraries are available when my code runs?+
pandas, numpy, and the full standard library (json, csv, re, datetime, os, collections, itertools, functools, and more). Your imports work and file I/O works exactly as it would in a real pipeline environment.
Does the evaluator review code style or just correctness?+
Both. The evaluator checks correctness (including edge cases), then reviews code quality: function decomposition, naming, Pythonic patterns, error handling, and performance. These dimensions map directly to the rubric categories used by interviewers at top tech companies.
How many Python questions does DataDriven have?+
Over 250, broken down by topic: data manipulation (40%), ETL logic (25%), file parsing (15%), API handling (10%), and pandas (10%). Each question includes test cases with intentionally messy data to simulate real interview conditions.
I already know Python well. Do I still need mock interview practice?+
Yes. Knowing Python and performing well in a Python DE interview are different skills. Interview conditions add time pressure, and DE questions add data messiness. Most experienced Python developers underperform on their first few mock interviews because they have not practiced writing error-resilient ETL code under a timer. After 10 to 15 mock sessions, performance stabilizes.
02 / Why practice

Write Python That Actually Runs, Not Pseudocode

  1. 01

    Active recall beats re-reading by 50%

    Cognitive-science meta-reviews (Dunlosky et al., 2013) rank practice testing as a top-tier study technique, while re-reading and highlighting rank near the bottom

  2. 02

    76% of hiring managers reject on the coding task, not the resume

    From HackerRank's 2024 Developer Skills Report. Candidates who look strong on paper still fail the live screen if they haven't done timed, executable practice

  3. 03

    Five problem shapes cover 80% of data engineer loops

    Dedup, sessionization, top-N-per-group, slowly-changing dimensions, partition tricks. Writing the shapes by hand turns the unfamiliar into pattern recognition

Related Interview Guides