Data Processing & Parallelism Interview Questions (Python)
4 Data Processing & Parallelism questions from the Python track. Read each short answer here, then open a question for the full explanation, examples, common mistakes, and sources.
- Mid-level
Why are vectorized operations in NumPy faster than Python loops, and what is broadcasting?
Because NumPy stores numbers in a contiguous array with a fixed type and runs the operation over all elements in a loop compiled in C, instead of handling a Python object for each element. Broadcasting is a set of rules that lets an operation apply between two arrays of different shapes without copying data.
Read the full explanation - Mid-level
What is the chained assignment problem in pandas and how did Copy-on-Write change it?
Chained assignment such as df[df.a > 0]["b"] = 1 modifies a temporary copy, not the original DataFrame. With Copy-on-Write (the default in pandas 3.0) every slicing result behaves as an independent copy, so chained assignment never modifies the original, and the correct way is loc in a single step.
Read the full explanation - Mid-level
How do you reduce memory use and speed up analysis in pandas?
Choose appropriate data types (category for repeated strings, smaller-sized numbers, and Arrow strings), read only the needed columns, and use vectorized operations and groupby with built-in functions instead of apply with a Python function per row.
Read the full explanation - Senior
How do you choose between multiprocessing, free-threaded Python, and subinterpreters for parallel data processing?
multiprocessing is the most mature and compatible option but costs a lot in moving data between processes. Free-threaded Python (officially supported since 3.14) allows true parallelism between threads with shared memory if the libraries are compatible. Subinterpreters (InterpreterPoolExecutor in 3.14) isolate state like processes at a lower cost.
Read the full explanation