8

I have a jupyter notebook and I would like to perform several runs, the code I want to run depending on the results of the previous runs. I divided my notebook into several cells, and for each run I would like to select which cell should be executed and which one should not. Is there a functionality which looks like "run all cells except those I explicitly deactivate"?

Manu H
  • 409
  • 2
  • 4
  • 13

3 Answers3

9

Welcome to DataScience.SE!

This is not currently possible. You could change the cells to Raw.

Emre
  • 10,491
  • 1
  • 29
  • 39
0

Two methods that come to mind are to use 'm' [convert to markdown], and then 'y' to reactivate it [convert to code], or to just use the comment function: Ctrl+a to highlight everything in the cell and Ctrl+/ to uniformly comment, or uncomment, the code.

0

You can use a condition at the cost of one extra indentation.

cellEnabled = 0
#cellEnabled = 1

if cellEnabled: doA() doB()

nvd
  • 101