0

I run a Jupyter Notebook (JupyterLab) which does some heavy computation in a loop for e episodes. DURING THE EXECUTION of the notebook I would like to set the counter x close to e, so the loop will finish with the next iteration or so. Is that possible to change a variable at runtime? I would like to stop the this loop early but still execute the whole code of the notebook.

#stuff happening before
for x in range(e):
    #important calculations (takes forever)
#stuff happening after

The only way I know to stop the execution is to interrupt, where I would loose the data right?

Thanks in advance. :)

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
quibelua
  • 13
  • 3
  • 1
    Can you not use an `if` statement to `break` the loop at a certain value for `x`? – C.Nivs Feb 28 '19 at 21:21
  • maybe this will help: https://stackoverflow.com/questions/32081926/a-new-thread-for-running-a-cell-in-ipython-jupyter-notebook – Tacratis Mar 01 '19 at 03:40

0 Answers0