How to Import NumPy?

Profile picture for user devanshi.srivastava
Submitted by devanshi.srivastava on

For importing the Numpy Package, we need to install the Numpy Package. After we have done the installation for the Numpy Package, we can now move to Python Prompt and enter the following code to check whether it is working correctly or not.

import Numpy as np 

If you want to check the version, you can enter the following codes.

import numpy as np



If Numpy Package has been installed and imported successfully, you will get output similar to this.  

Why do we use to import NumPy as np?

In Python, we use an alias which is an alternate name for referring to the same thing. Creating an alias is very easy, we can use as  keyword before an alias while importing.
The import as syntax allows us to bind the import to the local variable of our choice. Generally, to avoid using NumPy every time, we can use np. It will be easier for us to call the NumPy function wherever and whenever needed. The NumPy package is bound to the local variable np.