Chapter 1: NumPy Editor
NumPy Editor / IDE / Working Environment Guide written in the style of a patient, experienced teacher who is sitting next to you and helping you set up the most comfortable, productive, and beginner-friendly environment for learning and using NumPy seriously.
We will cover everything you actually need — from installation to daily workflow, keyboard shortcuts, debugging tricks, visualization helpers, notebook best practices, and common pain points — so that you feel “at home” when writing NumPy code.
1. Choose Your Main Working Environment (2025 realistic choices)
Most people use one of these four setups in 2025:
| Environment | Best for | Learning curve | Speed of feedback | Recommendation for NumPy beginners |
|---|---|---|---|---|
| Jupyter Notebook / Lab | Interactive exploration, teaching | very low | instant | ★★★★★ (start here) |
| VS Code + Jupyter extension | Long-term serious work, debugging | low–medium | instant–fast | ★★★★★ (move here after 1–3 months) |
| Google Colab | Zero installation, GPU/TPU, sharing | very low | instant | ★★★★☆ (great if you have no laptop) |
| PyCharm / DataSpell | Professional project, large codebase | medium | fast | ★★★☆☆ (later, when doing real projects) |
Teacher’s honest recommendation for most learners in 2025:
- Start with JupyterLab (local) or Google Colab (cloud)
- After 1–3 months → switch to VS Code + Jupyter extension (best long-term balance of interactivity + serious coding)
2. Option A – JupyterLab (local – most recommended)
Step-by-step installation (Windows / macOS / Linux)
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 1. Create clean environment (very important!) python -m venv numpy-env source numpy-env/bin/activate # macOS/Linux numpy-env\Scripts\activate # Windows # 2. Install essentials pip install --upgrade pip pip install jupyterlab notebook ipywidgets matplotlib seaborn pandas numpy scipy # 3. Optional but very useful extensions pip install jupyterlab-lsp jupyterlab-git rise # 4. Start JupyterLab jupyter lab |
Open http://localhost:8888 in your browser → you’re ready.
Daily JupyterLab workflow tips (what experienced users actually do)
- Always start with magic commands
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
%matplotlib inline # or %matplotlib widget for interactive plots %config InlineBackend.figure_format = 'retina' # crisp plots on high-DPI screens import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_theme(style="whitegrid") |
- Useful magic commands
|
0 1 2 3 4 5 6 7 8 9 10 11 12 |
%timeit np.arange(1000000).sum() # performance testing %whos # see all variables + sizes %reset -f # clear namespace %loadpy my_script.py # load code from file |
- Quick variable explorer Install jupyterlab-variableInspector extension
3. Option B – VS Code + Jupyter (my personal favorite for serious work)
Installation & setup (5 minutes)
-
Install VS Code
-
Install these extensions (search in Extensions panel):
- Jupyter (by Microsoft)
- Python (by Microsoft)
- Pylance (better autocompletion)
- Jupyter Notebook Renderers
- Jupyter Keymap (optional – makes shortcuts feel like classic Jupyter)
-
Create or open .ipynb file → VS Code automatically starts Jupyter kernel
My favorite VS Code + Jupyter workflow
- Ctrl+Enter → run current cell
- Shift+Enter → run cell and go to next
- Alt+Enter → run cell and insert new below
- Ctrl+/ → comment / uncomment line(s)
- F5 or Run → Run All → run whole notebook
- Outline panel (left sidebar) → jump between markdown & code sections
- Variable explorer (top-right in Jupyter toolbar) → click any array → see shape, dtype, min/max, plot preview
4. Quick NumPy starter cell (copy-paste this every new notebook)
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# ──────────────────────────────────────────────── # NumPy Starter Cell – 2025 edition # ──────────────────────────────────────────────── %matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_theme(style="whitegrid", palette="muted", font_scale=1.1) pd.set_option('display.max_columns', 12) pd.set_option('display.float_format', '{:.4f}'.format) print("NumPy version:", np.__version__) print("Ready to go! 🚀") |
5. Most useful keyboard shortcuts (JupyterLab & VS Code Jupyter)
| Shortcut | JupyterLab | VS Code Jupyter | What it does |
|---|---|---|---|
| Shift + Enter | Run cell, go to next | Run cell, go to next | most used |
| Ctrl + Enter | Run cell, stay | Run cell, stay | re-run same cell |
| Alt + Enter | Run + insert new cell | Run + insert new cell | quick prototyping |
| Ctrl + / | Toggle comment | Toggle comment | comment blocks fast |
| Ctrl + D | Delete cell | Delete cell | remove mistakes |
| Ctrl + Z | Undo cell action | Undo | lifesaver |
| Ctrl + M H | Show all shortcuts | Ctrl + K Ctrl + H | learn more shortcuts |
| A / B | Insert cell Above / Below | A / B (command mode) | fast cell creation |
6. Daily habits that make NumPy 10× more pleasant
| Habit | Why it helps |
|---|---|
| Always use %matplotlib inline or widget | Plots appear inside notebook |
| Start every notebook with the starter cell | Consistent look & feel |
| Use np.set_printoptions(precision=4, suppress=True) | Cleaner array printing |
| Keep a “scratch” notebook open | Quick tests without polluting main file |
| Use sns.set_theme() early | Plots look professional with zero effort |
| Name arrays meaningfully (X_train, features, pixels, returns) | Code becomes self-documenting |
7. Quick mini-exercise to feel the difference
Copy-paste and run these cells one by one:
|
0 1 2 3 4 5 6 7 8 |
# Cell 1 – classic Python lst = list(range(1_000_000)) %timeit sum(lst) |
|
0 1 2 3 4 5 6 7 8 9 10 |
# Cell 2 – NumPy arr = np.arange(1_000_000) %timeit arr.sum() %timeit np.sum(arr) |
|
0 1 2 3 4 5 6 7 8 9 10 |
# Cell 3 – why axis matters m = np.random.randint(1, 100, size=(6, 8)) print("Sum everything:", m.sum()) print("Sum per column:", m.sum(axis=0)) print("Sum per row:", m.sum(axis=1)) |
Final teacher message
You don’t need a “perfect” setup on day 1.
Start with Google Colab or local JupyterLab — that’s enough. After 1–4 weeks, when you feel you’re writing real code and getting annoyed by small things → switch to VS Code + Jupyter extension.
The most important thing is not the tool — it’s writing many small cells, running them one by one, looking at shapes and values, printing intermediate results, and experimenting.
You will become fluent much faster if you play a lot rather than trying to read everything perfectly first.
Now — what would you like to do next?
- More exercises on array creation, indexing, broadcasting
- Common beginner mistakes & how to debug them
- Setting up VS Code + Jupyter perfectly (with extensions & shortcuts)
- Creating beautiful plots from day 1 with Seaborn + NumPy
- A small real mini-project to practice everything
Just tell me what feels most helpful right now! 😊
