Has it ever happened to you that you’ve rebooted your computer and forgot about that important Jupyter Notebook you’ve intended to use later? “It took so long to finish and all is lost now”.

I feel you! It happened to me many times.

Well, the only advice I can give you is to “Restart the Kernel and rerun all the cells”. But it doesn’t have to be like that next time.

Meet Dill

Image for post

Save and restore a session with Dill

Dill enables you to save the state of a Jupyter Notebook session and restore it with a single command.

To install Dill is as simple as installing any other Python package:

pip install dill

To a save a Jupyter Notebook Session simply execute the command below:

import dill
dill.dump_session('notebook_env.db')

To restore a Jupyter Notebook session:

import dill
dill.load_session('notebook_env.db')

Dill also works with python interpreter sessions.

#programming #data-science #jupyter-notebook #python

How To Restore Your Jupyter Notebook Session
12.60 GEEK