Skip to content
Learn Netverks

Lesson

Step 2/36 6% through track

what-is-numpy

What is NumPy?

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
beginner

This lesson

This lesson teaches What is NumPy?: NumPy ndarray operations, vectorization, and numerical patterns used across the Python scientific stack.

Teams apply What is NumPy? in every serious NumPy project—skipping it leaves blind spots in analysis and reviews.

You will apply What is NumPy? in contexts like: Notebooks, feature engineering pipelines, and custom numerical code.

Read the narrative, run `import numpy as np` snippets in the playground (install NumPy with pip if the runner lacks it), tweak shapes and dtypes, and complete MCQs.

After /python/intro and ideally /data-science/intro workflow—before /pandas/intro labeled tables.

The NumPy library (Numerical Python) is the foundation of scientific computing in Python. Its core type is the ndarray: a multidimensional array of elements that share one dtype.

Core concepts

  • ndarray — n-dimensional array with shape, dtype, and ndim
  • Vectorization — apply operations to whole arrays without Python loops
  • Broadcasting — align differently shaped arrays for element-wise math
  • ufuncs — universal functions (np.add, np.sqrt) that run in C

Typical use cases

  • Image and signal processing (2D/3D arrays)
  • Feature matrices for machine learning
  • Simulation and Monte Carlo sampling
  • Linear algebra and statistics

Import convention

import numpy as np

x = np.zeros((2, 3))
print(x.shape)  # (2, 3)

Important interview questions and answers

  1. Q: Homogeneous vs heterogeneous?
    A: All elements share one dtype—unlike Python lists that can mix int, str, and objects.
  2. Q: Why import as np?
    A: Universal convention—readable and matches documentation across the ecosystem.

Self-check

  1. Name four core NumPy concepts.
  2. Give one real-world use case for ndarrays.

Tip: Always print shape and dtype when debugging arrays.

Interview prep

Homogeneous?

All elements share one dtype—unlike Python lists.

Vectorization?

Operations apply to whole arrays via ufuncs in compiled code.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Homogeneous buffer?
  • Shape tuple meaning?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump