0

After I closed browser, and try to restart jupyter again, it aways say

NameError: name 'train' is not defined

Is there anyway to directly run the last code cell?

Such as

train.shape

Thomas K
  • 39,200
  • 7
  • 84
  • 86
Jiachen
  • 23
  • 1
  • 7
  • If the *kernel* that was running your code has been restarted (including if you launched Jupyter again), then you have to rerun whatever code defined `train`. If you just refresh the page you're viewing it in, the kernel stays running, and your variables still exist. – Thomas K May 14 '16 at 22:14
  • Hence, there is no way to store the calculated variables( like RStudio, anytime restart RStudio), it will automatically remember and restored the functions and variables you used if I restart my computer, right? – Jiachen May 14 '16 at 23:40
  • If you want to store variables, the [dill](https://pypi.python.org/pypi/dill) package has a `dump_session()` function to write your workspace to a file, and a corresponding `load_session()` to read it again. There's also a [%store magic](http://ipython.readthedocs.io/en/stable/config/extensions/storemagic.html) as an extension in IPython, that can store and load specific named variables. – Thomas K May 17 '16 at 17:19

0 Answers0