1. Help Center
  2. Homework and Notebooks

How to import libraries in jupyter notebook

Import in python is similar to #include header_file in C/C++. Python modules can get access to code from another module by importing the file/function using import. The import statement is the most common way of invoking the import machinery, but it is not the only way.

import module_name

When the import is used, it searches for the module initially in the local scope by calling __import__() function. The value returned by the function is then reflected in the output of the initial code.

import math
pie = math.pi
print("The value of pi is : ",pie)

from module_name import * 

In the above code module, math is not imported, rather just pi has been imported as a variable. 
All the functions and constants can be imported using *.