NumPy Examples
This directory contains a comprehensive collection of NumPy tutorials, exercises, and examples, consolidated from multiple GitHub repositories and deduplicated for clarity.
Use this folder to build array intuition, shape awareness, and vectorized thinking. The goal is not to finish every notebook. The goal is to become comfortable enough with arrays that pandas, embeddings, and model tensors stop feeling mysterious.
📁 Directory Structure
01-basics/
Beginner-friendly tutorials covering fundamental NumPy concepts
Files from python-bootcamp-numpy:
01-NumPy Arrays.ipynb- Array creation and basic operations01-Python Crash Course.ipynb- Python fundamentals02-Numpy Indexing and Selection.ipynb- Indexing, slicing, and selection02-Python Crash Course Exercises.ipynb- Python practice exercises03-Numpy Operations.ipynb- Mathematical operations and broadcasting
Files from NumPy tutorial:
NumPy Tutorial.ipynb- Comprehensive basics tutorial
Topics Covered:
- Array creation (from lists, built-in methods)
- Array attributes (shape, dtype, size, ndim)
- Indexing and slicing
- Basic operations (arithmetic, broadcasting)
- Array manipulation
Recommended Order: Start with 01-NumPy Arrays.ipynb, then NumPy Tutorial.ipynb
02-intermediate/
Intermediate topics for deepening NumPy knowledge
Files from Intro_To_Numpy:
intro.ipynb- Introduction to NumPy conceptsintro2.ipynb- Additional introductory materialcopyview.ipynb- Understanding copy vs viewfiltering.ipynb- Boolean indexing and filteringfun.ipynb- Fun NumPy tricks and patternsit.ipynb- Array iteration techniquess.ipynb- Stacking and splitting arrayssearcher.ipynb- Searching in arraysshaper.ipynb- Reshaping and transposingslice.ipynb- Advanced slicing techniquesslice2d.ipynb- 2D array slicing
Topics Covered:
- Memory management (copy vs view)
- Boolean indexing and fancy indexing
- Array searching and filtering
- Reshaping, stacking, splitting
- Advanced iteration patterns
Note: numpy_youtube directory was a duplicate of this content and has been excluded.
03-exercises/
Practice exercises to test and improve your NumPy skills
From numpy-100:
100_Numpy_exercises.ipynb- 100 curated NumPy exercises
Description: A collection of 100 exercises from easy (★☆☆) to hard (★★★), covering all aspects of NumPy. Great for systematic practice.
From numpy_exercises:
Topic-based exercise sets with solutions:
1_Array_creation_routines.ipynb/1_Array_creation_routines_Solution.ipynb2_Array_manipulation_routines.ipynb/2_Array_manipulation_routines_Solution.ipynb3_Binary_operations.ipynb/3_Binary_operations_Solution.ipynb4_String_operations.ipynb/4_String_operations_Solution.ipynb5_Mathematical_functions.ipynb/5_Mathematical_functions_Solutions.ipynb6_Arithmetic_operations.ipynb/6_Arithmetic_operations_Solutions.ipynb7_Statistics.ipynb/7_Statistics_Solutions.ipynb8_Linear_Algebra.ipynb/8_Linear_Algebra_Solutions.ipynb9_Sorting_and_searching.ipynb/9_Sorting_and_searching_Solutions.ipynb10_Random_sampling.ipynb/10_Random_sampling_Solutions.ipynb11_Set_routines.ipynb/11_Set_routines_Solutions.ipynb
Recommended Approach:
- Start with
100_Numpy_exercises.ipynbfor breadth - Use topic-based exercises for depth in specific areas
04-advanced/
Advanced tutorials and real-world applications
numpy-tutorials/
Advanced tutorials from the official NumPy tutorials repository:
Markdown Tutorials:
mooreslaw-tutorial.md- Data analysis with Moore’s Lawpairing.md- Pairing algorithmssave-load-arrays.md- Saving and loading NumPy arraystutorial-air-quality-analysis.md- Real-world data analysistutorial-deep-learning-on-mnist.md- Deep learning with NumPytutorial-deep-reinforcement-learning-with-pong-from-pixels.md- RL implementationtutorial-ma.md- Moving averagestutorial-nlp-from-scratch.md- NLP fundamentalstutorial-plotting-fractals.md- Fractal generationtutorial-static_equilibrium.md- Physics simulationtutorial-style-guide.md- NumPy coding best practices
Data Files:
air-quality-data.csv- Air quality datasettransistor_data.csv- Transistor data for Moore’s Law
Topics Covered:
- Real-world data analysis
- Scientific computing (physics, engineering)
- Deep learning from scratch
- Reinforcement learning
- NLP fundamentals
- Data visualization
- Performance optimization
05-ml-applications/
Machine learning algorithms implemented from scratch with NumPy
numpy-ml/
A complete library of ML algorithms implemented in pure NumPy.
Repository: https://github.com/ddbourgin/numpy-ml
Contents:
- Neural networks (MLP, CNNs, RNNs, LSTMs, attention mechanisms)
- Reinforcement learning (DQN, A3C, DDPG)
- Decision trees and ensemble methods
- Linear models (regression, classification)
- Gaussian processes
- Hidden Markov Models
- Bayesian models
- Preprocessing utilities
Use Cases:
- Understanding ML algorithms at a low level
- Educational implementations
- Reference for algorithm details
- Building custom ML pipelines
Note: This is a complete library. See its README.md for detailed documentation.
🎯 Learning Path
Beginner (0-2 weeks)
- Start with
01-basics/01-NumPy Arrays.ipynb - Work through
01-basics/NumPy Tutorial.ipynb - Practice with first 30 exercises in
03-exercises/100_Numpy_exercises.ipynb
Intermediate (2-6 weeks)
- Complete all notebooks in
02-intermediate/ - Finish remaining exercises in
03-exercises/100_Numpy_exercises.ipynb - Work through topic-based exercises in
03-exercises/(with solutions)
Advanced (6+ weeks)
- Study tutorials in
04-advanced/numpy-tutorials/ - Implement projects from the tutorials
- Explore
05-ml-applications/numpy-ml/for ML implementations
How To Use This Folder Well
- Complete a small basics pass before spending time on the advanced archive.
- Prioritize indexing, broadcasting, reshaping, and reduction operations because those transfer everywhere else.
- Use the exercise sets to check fluency, not just recognition.
- Return to this folder whenever later phases expose confusion about shapes, similarity math, or vectorized computation.
📊 Content Statistics
- Total Notebooks: ~50+ unique notebooks
- Total Exercises: 100+ (numpy-100) + 11 topic sets
- Advanced Tutorials: 10+ real-world applications
- ML Implementations: Complete library with 100+ algorithms
🗑️ Excluded Content (Duplicates)
The following directories were excluded because they contained duplicate content:
numpy_youtube/
- Status: Duplicate of
Intro_To_Numpy/ - Reason: Contains identical files with same filenames
- Files: copyview.ipynb, filtering.ipynb, fun.ipynb, intro.ipynb, it.ipynb, s.ipynb, searcher.ipynb, shaper.ipynb, slice.ipynb, slice2d.ipynb
📚 Source Repositories
This consolidated collection was created from the following GitHub repositories:
- python-bootcamp-numpy - Pierian Data Python for Data Science Bootcamp
- NumPy Tutorial - Basic NumPy tutorial
- Intro_To_Numpy - YouTube-based NumPy course
- numpy-100 - https://github.com/rougier/numpy-100
- numpy_exercises - Topic-based NumPy exercises
- numpy-tutorials - https://github.com/numpy/numpy-tutorials
- numpy-ml - https://github.com/ddbourgin/numpy-ml
🚀 Getting Started
# Install NumPy
pip install numpy
# Import NumPy
import numpy as np
# Verify installation
print(np.__version__)💡 Tips for Success
- Practice Daily: Work through 3-5 exercises per day
- Type Code: Don’t copy-paste; type out examples to build muscle memory
- Experiment: Modify examples to test your understanding
- Read Docs: Use
np.array?in Jupyter to access documentation - Debug: Use
print()statements to understand array shapes and values - Performance: Use
%timeitto compare different approaches
🔗 Additional Resources
What Comes Next
- Continue to ../2-pandas-examples/README.md to move from arrays into tabular workflows.
- Continue to ../4-matplotlib/README.md to visualize the data you manipulate here.
- Continue to ../../05-embeddings/README.md later when you want to see vector operations show up in AI systems directly.
📝 Contributing
If you find errors or have improvements:
- Note the specific file and line number
- Describe the issue or improvement
- Submit corrections or enhancements
📄 License
Individual directories may have their own licenses. Please refer to original repository licenses for attribution and usage rights.
Last Updated: December 2024 Consolidated By: Automated deduplication process Total Files Before: 158 files across 8 directories Total Files After: ~60 unique files (62% reduction)