Say you have been working a lot in your current notebook, you have lots of DataFrames and Series that get a long time to be computed, and you want to make sure you recover quickly if, for some reason, your Session (Kernel) dies.
The answer is “dill”.
Installation:
pip install dill
Save a Notebook session:
import dill dill.dump_session('notebook_env.db')
Restore a Notebook session:
import dill dill.load_session('notebook_env.db')
Caveats:
Refs: