Introduction to NumPy
• Powerful Numerical Computing with Python
• Presented by: [Your Name]
• Date: [Insert Date]
What is NumPy?
• NumPy = Numerical Python
• Core library for numerical and scientific
computing in Python
• Provides fast and efficient operations on
arrays and matrices
• Backbone of libraries like pandas, SciPy,
TensorFlow
Why Use NumPy?
• Faster and more memory-efficient than
Python lists
• Supports multi-dimensional arrays
• Convenient array broadcasting and vectorized
operations
• Many built-in mathematical functions
Installing NumPy
• pip install numpy
• Check version:
• import numpy as np
• print(np.__version__)
Creating Arrays
• import numpy as np
• a = np.array([1, 2, 3])
• b = np.array([[1, 2], [3, 4]])
• Use np.zeros(), np.ones(), np.arange() to
initialize arrays
Array Properties
• a.shape # Dimensions
• b.ndim # Number of dimensions
• a.size # Number of elements
• a.dtype # Data type of elements
Array Operations
• a + 10
• b*2
• np.sqrt(a)
• Matrix multiplication:
• np.dot(a, a)
Indexing and Slicing
• a[0:2]
• b[:, 0]
• a[a > 1]
Reshaping and Transposing
• c = np.arange(6).reshape(2, 3)
• c.T
Broadcasting
• a+5
• a = np.array([[1], [2], [3]])
• b = np.array([10, 20, 30])
• a+b
Useful Functions
• np.mean(a)
• np.std(a)
• np.max(a)
• np.random.rand(3, 3)
Real-World Applications
• Data analysis (pandas)
• Machine learning (TensorFlow, PyTorch)
• Image processing (OpenCV, PIL)
• Simulations and modeling
Summary
• NumPy is essential for numerical computing in
Python
• Efficient, fast, and flexible
• Forms the base of many other libraries
Questions? / Thank You!
• Thank you for your attention
• Questions and discussion