Ipython Notebook: how to run multiple cells?

后端 未结 3 1324
借酒劲吻你
借酒劲吻你 2021-01-11 11:04

My notebook gets a bit of long, I divide it into several parts. Sometimes, I just want to run a certain part of it, i.e consecutive cells

For example, <

相关标签:
3条回答
  • 2021-01-11 11:07

    I know this is not the answer your are looking for (because its not the answer I was looking for) but for your specific case of running cells 52-54, because they are sequential and continuous, you can simply click the play button (run cell and select below) 3 times

    and it will queue those cells for running. This will work for a handful of sequential cells, but for out of sequence or really long blocks of cells, probably not the best ideal

    0 讨论(0)
  • 2021-01-11 11:25

    UPDATE as per Jan 2018: You can select and run multiple cells in command mode using the below shortcuts:

    1.shift+K (select the cells in an upward direction) and then Ctrl+Enter

    2.shift+J (select the cells in a downward direction) and then Ctrl+Enter

    0 讨论(0)
  • 2021-01-11 11:31

    I found a useful extension that performs a similar function: init_cell. First, you will need to install jupyter nbextensions configurator as described here.

    Then search for "Initialization cells" from inside the search bar of the Jupyter nbextension manager.

    A check box at the top of every cell will appear. You can select which cells to be marked as initialization cells.

    To run all the initialization cells at once, click the button with calculator symbol on the tool bar:

    Along with cqcn1991's solution, you can gain a reasonable control over your notebook.

    0 讨论(0)
提交回复
热议问题