How this NumPy track works
- Python playground — lessons use
execution_profile: server_script. Every snippet usesimport numpy as np; install NumPy locally withpip install numpyif the runner lacks it. - Arrays first — creation, dtypes, shape, indexing, ufuncs, broadcasting, linear algebra, and performance—before Pandas labeled tables.
- Prerequisites — finish Python basics and skim Data Science workflow. Statistics intuition from that track helps.
- Pair with — Pandas for DataFrames, SciPy for scientific routines, and AI for ML context.
Run each lesson in the playground, tweak array values, and use MCQs to lock in ndarray vocabulary.
Install on your device (macOS, Linux, Windows)
Install Python 3.11+ locally for notebooks and frameworks; the on-site playground uses the dev runner when enabled.
macOS
brew install python@3.12or install from python.org (check “Add to PATH” on installers).- Create a project folder:
mkdir ~/python-practice && cd ~/python-practice. python3 -m venv .venv && source .venv/bin/activatepip install --upgrade pip
Linux
- Debian/Ubuntu:
sudo apt update && sudo apt install -y python3 python3-pip python3-venv - Fedora:
sudo dnf install -y python3 python3-pip python3 -m venv .venv && source .venv/bin/activatepip install --upgrade pip
Windows
- Install from python.org and enable Add python.exe to PATH.
- Or:
winget install Python.Python.3.12 - PowerShell:
py -3 -m venv .venv; .\.venv\Scripts\Activate.ps1 pip install --upgrade pip
Verify: python3 --version (or py --version on Windows) shows 3.11+.
Run code on this site (Backend & language playgrounds)
- Clone or open this project locally; copy
.env.exampleto.env. - Ensure
LEARNING_RUNNER_ENABLED=trueandLEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute. - Terminal 1:
php artisan serve(orcomposer run devfor Laravel + Vite + runner together). - Terminal 2:
npm run runner— keep it running while you click Run on server.
In your venv: pip install numpy
NumPy provides the ndarray—a fast, homogeneous n-dimensional array—and vectorized operations that power Pandas, SciPy, and most Python ML stacks. This track teaches array thinking after Python basics and alongside Data Science workflow concepts.
Prerequisites and how this track works
Complete Python basics (lists, loops, functions) and skim Data Science intro for workflow context. Lessons run Python with execution_profile: server_script; NumPy is pre-installed in the playground—no pip install needed here.
What you will learn
- Creating, shaping, and indexing
ndarrayobjects - Dtypes, broadcasting, ufuncs, and axis-aware aggregations
- Linear algebra, fancy indexing, and memory views
- NaN handling, persistence (
.npy), and vectorization habits - How NumPy connects to Pandas, Matplotlib, SciPy, and ML libraries
First run
import numpy as np
a = np.array([1, 2, 3, 4, 5])
print('NumPy version:', np.__version__)
print('array:', a)
print('shape:', a.shape, 'dtype:', a.dtype)
Why not plain Python lists?
Lists hold arbitrary objects and loop in Python bytecode. NumPy stores contiguous typed buffers and delegates math to optimized C—often 10–100× faster on large numeric data.
Important interview questions and answers
- Q: Is NumPy required for data science?
A: Not strictly—but Pandas, scikit-learn, and most scientific Python assume NumPy arrays under the hood. - Q: What is an ndarray?
A: An n-dimensional homogeneous array: fixed dtype, shape tuple, and strided memory layout.
Self-check
- Which two tracks should you finish before deep NumPy work?
- What does ndarray stand for?
Challenge
First NumPy run in this track
- Click Run with the default code.
- Confirm the terminal shows array shape and dtype.
- Change one element in the sample array and run again.
Done when: the terminal shows ndarray output and your edited value.
Tip: Run the playground challenge—every lesson assumes import numpy as np works.
Interview prep
- Prerequisite?
Python basics (/python/intro) and data science workflow (/data-science/intro).
- Core type?
ndarray—homogeneous n-dimensional array with shape and dtype.
- Next track?
Pandas (/pandas/intro) for labeled tables; SciPy (/scipy/intro) for scientific algorithms.