Python interview questions
100 Data Engineering practice questions. Read what a strong answer covers, then practise it out loud against the clock.
Practise Python questionsBeginner
- *args and **kwargs
- A few malformed rows in a CSV
- Adding tests to an untested transform
- API returning 429 Too Many Requests
- Comparing two files for differences
- Dictionaries and sets
- enumerate and zip
- Exception handling
- Flattening nested JSON into a table
- Flattening nested lists of IDs
- is vs ==
- Job failed with no useful logs
- Lambda, map and filter
- List comprehensions
- List vs tuple
- Logging instead of print
- Managing dependencies
- Mixed date formats in source data
- Mutable vs immutable objects
- pandas loop taking hours
- Password hard-coded in a script
- Reading CSV and JSON in Python
- Reading files from S3 in Python
- Removing duplicate records from a list
- Scheduling a Python script
- Script crashes reading a big CSV
- Script fails halfway and reruns duplicate data
- Shallow vs deep copy
- String formatting with f-strings
- Totals off by a few paise
- Truthiness and None
- Using with for files
- Validating an email column
- Virtual environments
Intermediate
- Building a reusable retry helper
- Calling REST APIs with pagination
- Configuration and secrets in Python jobs
- Data validation with pydantic and dataclasses
- Dates and time zones in Python
- Decorators
- Generators and yield
- Hourly report broken by daylight saving
- Incremental API ingestion to S3
- Ingesting 40 similar database tables
- Ingesting messy Excel files from business teams
- Iterables vs iterators
- Job broke after a library update
- Memory growing in a long-running job
- merge and groupby in pandas
- Mocking external services in tests
- Packaging shared code
- pandas DataFrame basics
- pandas groupby too slow on 80 million rows
- Processing 100,000 files in S3
- Processing files bigger than memory
- Retries with exponential backoff
- Row count jumped after a pandas merge
- Speeding up thousands of API calls
- Testing a job that calls an external API
- Type hints in Python
- Unit testing with pytest
- Upserting records into Postgres from Python
- Validating incoming webhook payloads
- Vectorization vs loops
- Watermark missed records with same timestamp
- Writing custom context managers
- Writing partitioned Parquet
Experienced
- Apache Arrow and Parquet in Python
- asyncio for high-volume API ingestion
- Choosing pandas, Polars, DuckDB or PySpark
- Config-driven ingestion frameworks
- Conflicting dependencies across pipelines
- Connection pooling
- CPU-heavy transformation is slow
- Designing a Python ingestion framework
- Designing an idempotent Python ETL job
- Error handling strategy for bad records
- Extracting 500 million rows nightly
- Extracting large tables from a database
- Float vs Decimal for money
- GIL, threads, processes and asyncio
- Loading data from Python into a warehouse efficiently
- Making 50 Python jobs observable
- Memory management in Python
- One million API calls per day
- Parameterized queries and SQL injection
- Parsing huge JSON files
- PII appearing in logs
- Pipeline killed by OOM in a container
- Producer faster than the loader
- Productionizing notebook code
- Profiling Python performance
- Python Kafka consumer losing or duplicating messages
- Refactoring a 3,000-line pipeline script
- Replacing a Spark cluster with DuckDB
- Same job running twice at once
- Source schema changes breaking ingestion
- Structured logging and observability
- Testing strategy for a pipeline codebase
- Writing testable pipeline code