In the first cell of every IPython (Jupyter) notebook, I almost always type:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
Is there a way to make it so that this cell appears at the top of each new notebook I create by default?
For example, could I save a template .ipynb
file somewhere, which is copied by iPython when creating a new notebook?
(I found this question, but it seems to be more about css than default content in cells.)
There is a pretty cool solution using jupyterlab: jupyterlab_templates
Installation took about 5 minutes and you can have as many
templates as you'd like.
Assuming you have conda installed than during the installation, you'll need to install node js engine:
conda install -c conda-forge nodejs
And create a jupter_noteook_config.py if you don't have one :
jupyter notebook --generate-config