Welcome to the NumPy Masterclass repository!
This repo is your all-in-one resource to master NumPy — the powerful Python library used for fast and efficient numerical operations.
Whether you're a beginner in data science, a Python developer, or prepping for technical interviews, this hands-on guide will walk you through every essential NumPy topic, with practical examples and clean code in each section.
- How to create and manipulate NumPy arrays
- Understand array properties and data types
- Perform indexing, slicing, reshaping, and filtering
- Use advanced operations like broadcasting, vectorization, and aggregation
- Handle missing or invalid values in datasets
- Build a real-world mini project using restaurant data
The folders in this repository are arranged in a progressive learning order. Start from the top and work your way down:
Learn how to create arrays using functions like np.array
, np.zeros
, np.ones
, np.arange
, and np.linspace
. This is the foundation of all NumPy operations.
Understand the basic properties of arrays including:
shape
,ndim
,dtype
,size
- Data type conversions
- Memory layout of arrays
Master the core of data access using:
- Basic and advanced indexing
- Slicing 1D and 2D arrays
- Fancy indexing
- Boolean masking and conditional filters
Learn to reshape arrays using:
reshape
,flatten
,ravel
,resize
- Stack and split arrays with
hstack
,vstack
,split
,hsplit
, etc. - Insert, delete, and append values to arrays
Dive into powerful mathematical operations including:
- Element-wise arithmetic
- Aggregation functions:
sum
,mean
,min
,max
,std
,var
- Sorting, comparisons, and statistical summaries
Learn how NumPy automatically expands smaller arrays to match larger shapes:
- Broadcasting rules and use-cases
- Replace loops with vectorized operations for better performance
Explore techniques to handle incomplete or invalid data:
- Use of
np.nan
andnp.isnan()
- Replacing missing values
- Filtering or imputing data
Apply everything you've learned in a real-world scenario:
- Load a restaurant dataset using NumPy
- Clean and preprocess the data
- Perform analysis and compute statistics
- Generate insights using slicing, masking, and aggregation
NumPy is the core library for scientific computing in Python, and it's the foundation for other libraries like Pandas, SciPy, Scikit-learn, and TensorFlow. Mastering NumPy gives you a huge head-start in data science, machine learning, and AI.
- Python 3.x
- NumPy (install via
pip install numpy
)
- Clone the repo and run the code snippets locally.
- Modify examples and observe how the results change.
- Try out extra exercises at the end of each file.
- Use Jupyter Notebooks for a more interactive experience.
numpy-masterclass/
│
├── creation/
├── numpy-array-properties/
├── indexing-and-slicing/
├── reshaping-and-manipulation/
├── numpy-operations/
├── broadcasting-and-vectorization/
├── handling-missing-values/
└── mini-project-restaurant-data/
Each topic is designed to be practical and example-driven. For deeper dives, check the official NumPy Documentation
If you spot any errors or want to contribute new examples, feel free to raise an issue or open a pull request.
Happy Learning! 🚀