MA
manojtharindu11/numPy-LP
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.txtRun
python main.pymain.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:
- Creating arrays +
np.append - Indexing + slicing
- Python list slices vs NumPy slices (views)
- 2D indexing + array metadata (
shape,ndim,dtype, etc.) - Constructors:
zeros,ones,empty,arange,linspace - Sorting + concatenation (
np.concatenate) - Reshaping + adding dimensions (
reshape,newaxis,expand_dims) - Boolean indexing +
np.nonzero - Views vs copies (
.copy()) - Stacking (
hstack,vstack) - Vectorized ops + reductions (
sum,prod, axis behavior) - Broadcasting + basic statistics (
max,min,mean,std, …) - Converting Python lists to arrays + 2D slicing
- Random numbers,
unique, transpose, flip,flattenvsravel - Saving/loading:
.npy,.npz,.txt,.csv
Files in this folder
main.py— the organized demo scriptrequirements.txt— dependenciesoutputs/— 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.