I am looking for a way to automatically (or as a shortcut) import a set of python modules in a jupyter notebook so that I don't have to import them every time I create a new notebook
I am finding it very repetitive to import these modules to every notebook. The closest thing I could think here is creating a python file and importing that as a module, but I am looking for something more flexible in Jupyter-notebook
# Example Code
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
What could be an easy way to import these long list of modules? as I am finding myself repeating the whole set of modules in every notebook.
You could have a file frequently_imported_modules.py
where you have literally only the imports you use frequently and then import all these in your new script like so:
from frequently_imported_modules import *
Whether this is a good practice? I don't think so.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.