Introduction to NumPy
NumPy stands for Numerical Python and it’s a fundamental package for scientific computing in Python. NumPy provides Python with an extensive math library capable of performing numerical computations effectively and efficiently. These lessons are intended as a basic overview of NumPy and introduce some of its most important features.
In the following lessons you will learn:
- How to import NumPy
- How to create multidimensional NumPy ndarrays using various methods
- How to access and change elements in ndarrays
- How to load and save ndarrays
- How to use slicing to select or change subsets of an ndarray
- Understand the difference between a view and a copy an of ndarray
- How to use Boolean indexing and set operations to select or change subsets of an ndarray
- How to sort ndarrays
- How to perform element-wise operations on ndarrays
- Understand how NumPy uses broadcasting to perform operations on ndarrays of different sizes.
NumPy is included with Anaconda. If you don’t already have Anaconda installed on your computer, please refer to the Anaconda section to get clear instructions on how to install Anaconda on your PC or Mac.
Updating NumPy to a Specific Version
You can choose to upgrade/downgrade your NumPy to a specific version by using the command shown below in the Terminal/Anaconda prompt.
Tip – Create virtual environments, which helps us to have multiple versions of Python and its packages.
# Use either one command conda install numpy=X.XX pip install --upgrade numpy==X.XX
X.XX could be one of the specific version number.
NumPy is a remarkable math library and it has many functions and features. In these introductory lessons, we will only scratch the surface of what NumPy can do. If you want to learn more about NumPy, make sure you check out the NumPy Documentation: