I just wrote my first extensive Python tutorial using IPython notebooks. All went well, except I did a lot of testing and moving blocks around. How do I reset the In [
Every .ipynb
file can be opened in an editor. Everything written there is in plain text (JSON). For each cell which has the "cell_type": "code"
there'd be another key-value pair as "execution_count":
. As you might have guessed, that is the prompt numbering. Hence, if the notebook contains code which will take time to execute (as was, in my case) this method would be time efficient.
Now, either you can manually change each execution_count
or write a simple script to get the numbering right. To check the results just refresh the notebook in the browser without stopping the kernel. And, everything will be as per your needs, even all the variables/loaded data will remain in the environment.