Say I have a jupyter nootebook with 200 cells.
how to run from 5th cell to 100th cell, without running other part of the notebook?
Now I commend out 101th-200th and 1st-4th cell. I'm sure it is not the best practise.
Say I have a jupyter nootebook with 200 cells.
how to run from 5th cell to 100th cell, without running other part of the notebook?
Now I commend out 101th-200th and 1st-4th cell. I'm sure it is not the best practise.
One cannot just run cells 5 thru 100 easily with the Jupyter notebook but there are a few options. The first is just selecting each cell and running Merge Cell Above from the edit menu then just running the new cell. The second, and best way I've found to do this is:
Now you've only run those middle cells and can just go back and reset the cell type to code (instead of having to comment and then un-comment) and keep going.
* If you are using NBViewer you can hide the code or just set it to Markdown
Another option which requires less mouse movement and clicks than JGreenwell's answer, especially if you prefer accomplishing this with speedy keyboard work like I would:
Ctrl+A
)Ctrl+/
)Shift+Enter
) -- will execute cell, but is meaningless since all code is commentedCtrl+A
, Ctrl+/
)You can easily move between cells using the keyboard: Press Esc
(command mode), Press J
(up) or K
(down) to select adjacent cell. Press Enter
(to enter the code). Then press Ctrl+A
then Ctrl+/
to un-comment. Repeat from Esc
.