Is it possible to create grouping of input cells i

2020-05-20 08:46发布

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.

4条回答
手持菜刀,她持情操
2楼-- · 2020-05-20 09:19

Latest version of Ipython/Jupyter notebook allows selection of multiple cells using shift key which can be useful for batch operations such as copy, paste, delete, etc.

查看更多
老娘就宠你
3楼-- · 2020-05-20 09:22

For anyone out there who needs the grouping feature: yes, there's a great extension here: https://github.com/ivanov/nb-cccp

The days of moving one cell at a time is over. Apparently it will be built into the next IPython version.

查看更多
可以哭但决不认输i
4楼-- · 2020-05-20 09:26

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.

查看更多
狗以群分
5楼-- · 2020-05-20 09:28
登录 后发表回答