What is NumPy?
NumPy (Numerical Python) is a Python library used for numerical and scientific computing.
It provides a powerful data structure called an array, which is useful for storing and processing numerical data.
Why Use NumPy?
It works efficiently with numerical data.
It provides powerful array operations.
It supports multi-dimensional arrays.
It provides mathematical functions.
It is widely used in Data Science and Machine Learning.
Installing NumPy
Step 1:
- Open Command Prompt or VS code Terminal
Step 2:
Run:
pip install numpy
Step 3:
- Wait until the installation is completed.
Step 4: Import NumPy
- After installation, import NumPy into your Python program.
import numpy as np
- numpy is the library name.
- np is the commonly used alias for NumPy.
Step 5: Check NumPy Version
print(np.__version__)
NumPy Array Attributes
- NumPy provides useful attributes to understand an array.
- Size - size tells the total number of elements.
- ndim - ndim tells the numbers of dimensions.
- dtype - dtype tells the data type of the elements.
- itemsize - itemsize tells how many bytes are used by each element.
- shape - shape tells the size of each dimension.

Top comments (0)