NumPy interviews test ndarray mechanics, broadcasting, memory views, vectorization, and linear algebra basics—often in Python DS/ML loops after Python and Data Science fundamentals.
High-frequency topics
- Shape, dtype, axis semantics
- Broadcasting rules and failure cases
- View vs copy; fancy vs slice indexing
- Boolean masking and np.where
- Matrix multiply vs element-wise
- NaN handling and nan-aware aggregates
Whiteboard pattern
- State input shapes and dtypes
- Draw axis direction for reductions
- Explain memory sharing for reshape/transpose
- Propose vectorized solution before loops
Sample verbal answer
“I'd use boolean indexing to filter, then nanmean on axis=0 for column summaries—avoiding Python loops and handling missing values.”
Important interview questions and answers
- Q: Broadcast (3,1) + (3,)?
A: Result shape (3,3)—column vector broadcast across rows. - Q: Why vectorize?
A: Python loop per element vs C batch—critical at million-row scale.
Self-check
- Name four common NumPy interview topics.
- Explain view vs copy in one sentence.
- How do you ignore NaN in mean?
Tip: Practice explaining broadcasting with a 2D sketch.
Interview prep
- Top topics?
Shape, broadcasting, views, boolean indexing, @ vs *.
- Vectorize why?
C-speed batch ops vs Python loop overhead.
- NaN in interview?
Mention isnan, nanmean, and imputation policy.