GitHunt
MA

Small, print-heavy examples for learning core NumPy concepts: arrays, slicing/views, reshaping, boolean indexing, vectorized math, reductions, and basic file I/O.

NumPy Learning Playground

Small, print-heavy examples for learning core NumPy concepts: arrays, slicing/views, reshaping, boolean indexing, vectorized math, reductions, and basic file I/O.

Requirements

  • Python 3.10+ (any recent 3.x should work)
  • NumPy (pinned in requirements.txt)

Install:

pip install -r requirements.txt

Run

python main.py

main.py is intentionally verbose and prints a lot. It is organized into numbered sections so you can scroll and learn.

What the script covers

In main.py you’ll see demos for:

  1. Creating arrays + np.append
  2. Indexing + slicing
  3. Python list slices vs NumPy slices (views)
  4. 2D indexing + array metadata (shape, ndim, dtype, etc.)
  5. Constructors: zeros, ones, empty, arange, linspace
  6. Sorting + concatenation (np.concatenate)
  7. Reshaping + adding dimensions (reshape, newaxis, expand_dims)
  8. Boolean indexing + np.nonzero
  9. Views vs copies (.copy())
  10. Stacking (hstack, vstack)
  11. Vectorized ops + reductions (sum, prod, axis behavior)
  12. Broadcasting + basic statistics (max, min, mean, std, …)
  13. Converting Python lists to arrays + 2D slicing
  14. Random numbers, unique, transpose, flip, flatten vs ravel
  15. Saving/loading: .npy, .npz, .txt, .csv

Files in this folder

  • main.py — the organized demo script
  • requirements.txt — dependencies
  • outputs/ — created automatically; contains generated files from the I/O demo

If you have np_data.npy, multiple_np.npz, textData.txt, or textData.csv in the project root, they’re likely leftovers from earlier runs before outputs were grouped.

Languages

Python100.0%

Contributors

Created February 22, 2026
Updated February 28, 2026
manojtharindu11/numPy-LP | GitHunt