This project demonstrates the usage of NumPy, a fundamental package for scientific computing with Python. NumPy provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays efficiently.
- Multi-dimensional array creation and manipulation
- Vectorized mathematical operations
- Linear algebra, statistics, and Fourier transform support
- Efficient broadcasting and slicing operations
- Integration with other Python libraries like Pandas, Matplotlib, and SciPy
You can install NumPy using pip:
pip install numpyHere are some basic examples of NumPy usage:
import numpy as np# 1D array
arr1 = np.array([1, 2, 3, 4, 5])
# 2D array
arr2 = np.array([[1, 2], [3, 4], [5, 6]])# Element-wise addition
arr_sum = arr1 + 10
# Multiplication
arr_mul = arr1 * 2
# Dot product
result = np.dot(arr1, arr1)# Accessing elements
print(arr2[0, 1]) # Output: 2
# Slicing
print(arr1[1:4]) # Output: [2 3 4]# Statistical operations
mean_val = np.mean(arr1)
max_val = np.max(arr1)
min_val = np.min(arr1)
# Reshape
reshaped = arr2.reshape(2, 3)- Speed: Efficient operations on large datasets using optimized C code.
- Memory Efficiency: Uses less memory than Python lists.
- Vectorization: Eliminates the need for explicit loops, improving performance.
- Community Support: Widely used in data science, machine learning, and scientific computing.
This project is open-source and available under the MIT License.