Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create grouping of input cells in IPython Notebook?

When I do data analysis on IPython Notebook, I often feel the need to move up or down several adjacent input cells, for better flow of the analysis story.

I'd expected that once I'd create a heading, all cells under that heading would move together if I move the heading. But this is not the case.

Any way I can do this?

Edit: To clarify, I can of course move cells individually, and the keyboard shortcuts are handy; but what I'm looking for is a way to group cells so that I can move (or even delete) them all together.

like image 899
ba_ul Avatar asked Jul 22 '14 19:07

ba_ul


People also ask

How do you split a Jupyter Notebook into sections?

Press Shift + M to merge your selection. To split the active cell at the cursor, press Ctrl + Shift + - in edit mode. You can also click and Shift + Click in the margin to the left of your cells to select them.


1 Answers

I use a little-known extension, which does exactly what you want (i.e. "once I'd create a heading, all cells under that heading would move together if I move the heading"). It is part of the Calico suite, but can be installed separately.

More specifically, you need to install a Calico Notebook Extension named Document Tools. From the description:

The Calico Document Tools extensions adds section moving, heading numbering, table of contents, and bibliography support. Demonstration of use: https://www.youtube.com/watch?v=YbM8rrj-Bms

I don't know whether the instructions of installation given on the wiki page are updated for IPython 3.0 (february 2015), but the source-code on BitBucket actually is.

I cannot install IPython 3.0 for the moment, but I gladly use this extension with IPython 2.x since last summer. It's great, perhaps less versatile than the asif.m's suggestion Collective Cut-Copy-Paste for IPython Notebooks (which, by the way, has not been updated for IPython 3.0), but IMHO faster and more logical.

like image 66
Aristide Avatar answered Sep 21 '22 15:09

Aristide