Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to split and merge cells in JupyterLab

Tags:

jupyter-lab

  • In JupyterLab, given the following code cell, how may it be split into multiple cells?

enter image description here

  • Likewise, given the following cells, how may they be combined into a single cell?

enter image description here

like image 662
Trenton McKinney Avatar asked Aug 30 '20 05:08

Trenton McKinney


1 Answers

  • This answer works for Windows

enter image description here

  • JupyterLab: splitCell
    • Source
  • In order to split one cell into many cells:
    • Place cursors where the split is desired, and then press and release ctrl + shift + -
    • Multiple cursors may be placed, by holding ctrl, and clicking the location for the cursor.

enter image description here

  • JupyterLab: mergeCells
    • Source
  • In order to merge multiple cells, into one:
    • Select the desired, consecutive cells, by holding shift, and clicking in the margin, where the [ ] is, which will highlight the selected cells.
    • While still holding shift, press m, and then release both keys.

enter image description here

  • The resulting merged cell, will have a space between the code from each cell, as does the first image in this answer.
    • This is the expected behavior newModel.value.text = toMerge.join('\n\n');
like image 145
Trenton McKinney Avatar answered Oct 11 '22 11:10

Trenton McKinney