What are the key features and advantages of NumPy?

Quick Overview

Asks for the main features of NumPy and why it outperforms plain Python lists for numerical work. Tests understanding of the ndarray memory layout, vectorized ufuncs, broadcasting, views versus copies and the library's practical limits.

What are the key features and advantages of NumPy?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

What are the key features and advantages of `NumPy`? Explain what makes it faster than plain Python for numerical work, and where its limits are. ```hint Look at memory and where the loop runs Compare how a Python list of a million floats and a NumPy array of the same values are stored, and where the per-element loop executes in each case. ``` ### What a Strong Answer Covers - The `ndarray` and why its memory layout makes it faster and smaller than a Python list - Vectorized operations and universal functions - Broadcasting, with the shape rule and an example - The numerical routines NumPy ships and the libraries built on top of it - Limitations and pitfalls such as fixed dtype and size, views versus copies, and in-memory computation ### Follow-up Questions - When does indexing a NumPy array return a view and when does it return a copy? - What happens when you subtract an array of shape `(n, 1)` from an array of shape `(n,)`, and why? - Why is calling `np.append` inside a loop slow, and what would you do instead? - When would you move from plain NumPy to pandas, Dask or a GPU array library?

Overview: Asks for the main features of NumPy and why it outperforms plain Python lists for numerical work. Tests understanding of the ndarray memory layout, vectorized ufuncs, broadcasting, views versus copies and the library's practical limits.

PracHub logo
General
Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

What are the key features and advantages of NumPy? Explain what makes it faster than plain Python for numerical work, and where its limits are.

What a Strong Answer Covers Guidance

  • The ndarray and why its memory layout makes it faster and smaller than a Python list
  • Vectorized operations and universal functions
  • Broadcasting, with the shape rule and an example
  • The numerical routines NumPy ships and the libraries built on top of it
  • Limitations and pitfalls such as fixed dtype and size, views versus copies, and in-memory computation

Follow-up Questions Guidance

  • When does indexing a NumPy array return a view and when does it return a copy?
  • What happens when you subtract an array of shape (n, 1) from an array of shape (n,) , and why?
  • Why is calling np.append inside a loop slow, and what would you do instead?
  • When would you move from plain NumPy to pandas, Dask or a GPU array library?