This repository contains my practice work on NumPy, one of the most popular Python libraries for numerical computing.
It includes examples of array creation, indexing, slicing, broadcasting, random number generation, mathematical operations, and visualization with Matplotlib.
The file demonstrates:
- Array Creation & Properties
- 1D, 2D, 3D arrays
shape
,ndim
,size
,dtype
,itemsize
zeros
,ones
,identity
,arange
,linspace
- Indexing & Slicing
- Row & column selection
- Fancy indexing
- Boolean indexing
- Mathematical Operations
- Element-wise operations
- Scalar multiplication
- Dot product
- Aggregate functions (
sum
,mean
,std
,min
,max
, etc.)
- Broadcasting
- Explained with practical scenarios
- Random Number Generation
randint
,uniform
,random
,seed
- Problem-Solving with NumPy
- Replace odd numbers with
-1
- Sorting arrays
- Percentile calculations
- Replace odd numbers with
- Visualization with Matplotlib
- Sine curve
- Quadratic function
Clone the repository:
https://github.com/Sidra-009/Numpy-Practice.git
Navigate into the repo:
bash
Copy code
cd numpy-practice
Run the Python file (or open in Jupyter Notebook):
bash
Copy code
python numpy_practice.py
π· Preview
Some examples from the code:
β
Sin curve plotted using np.linspace + matplotlib
β
Quadratic function visualization
β
Boolean indexing to filter values
β
Broadcasting examples explained with code
π Requirements
Python 3.x
NumPy
Matplotlib
Install dependencies:
bash
Copy code
pip install numpy matplotlib
β¨ Author
Sidra Saqlain
π If you find this helpful, donβt forget to give the repo a β!