Jupyter Notebook: How To Leave One Cell Out While 'run All'
I'm writing python using jupyter notebook and I have two cells that can influence each other. I'm wondering is it possible to leave some certain cells out after I click Restart &am
Solution 1:
One option based on Davide Fiocco's answer of this post and that I just tested is to include %%script
magic command on each cell you don't want to execute.
For example
%%script false --no-raise-error
for i inrange(100000000000000):
print(i)
Solution 2:
If you put those two cells at the end of the page, you can run all cells above a certain cell with a single click.
That or you can put a triple-quote at the beginning and end of the two cells, then un-quote the cells to test them.
Solution 3:
One option is to create a parameter and run the cells accordingly
x = 1# cell 1if x == 1:
// run this cell# cell 2if x != 1:
// run the other cell
In this example, you will skip cell 2
.
Post a Comment for "Jupyter Notebook: How To Leave One Cell Out While 'run All'"