Reputation: 6814
I have multiple Notebook cells where im importing the same libraries. Is there a way to import these libraries once (like in the very 1st cell) and allow all other cells to use them?
Since my notebook has several cells, each importing the same libraries, i'm starting to see alot of redundancies.
Upvotes: 3
Views: 4510
Reputation: 1
Go to the kernel option and then select restart kernel and run all the cells option. Then you don’t have need to import it in each cell
Upvotes: 0
Reputation: 4849
Of course! You can add all your libraries at the very top of your notebook. All of them will be available for use.
import pandas as pd
import numpy as np
import matolotlib.pyplot as plt
import seaborn as sns
Upvotes: 2