Chapter 1: Introduction

Importing NumPy

face Josiah Wang

To use NumPy:

import numpy as np

It is common to use np as a shorthand. We will assume that you have imported NumPy this way, and will use np in all the examples that will follow.

If you receive a ModuleNotFoundError, it means Python cannot find your NumPy installation.

If you have not yet installed NumPy, do it with pip install numpy.

Otherwise, check that you are using the correct version of Python or virtual environment.