Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the usage of tag over the cell in jupyter?

I found that, in jupyter notebook, there is a tag tool over the cell, which can be activated by "View - Cell Toolbar - Tags". But I can not figure out, why we need these tags. Can someone give some suggestions or usage examples?

enter image description here

like image 331
xirururu Avatar asked Dec 28 '17 21:12

xirururu


People also ask

What does %% do in Jupyter Notebook?

Both ! and % allow you to run shell commands from a Jupyter notebook. % is provided by the IPython kernel and allows you to run "magic commands", many of which include well-known shell commands. ! , provided by Jupyter, allows shell commands to be run within cells.

How do I mark a cell in Jupyter Notebook?

You can change the cell type of any cell in Jupyter Notebook using the Toolbar. The default cell type is Code. To use the Keyboard Shortcuts, hit the esc key. After that, you can change a cell to Markdown by hitting the m key, or you can change a cell to Code by hitting the y key.

How do I insert a cell above in Jupyter Notebook?

While in command mode: A to insert a new cell above the current cell, B to insert a new cell below. M to change the current cell to Markdown, Y to change it back to code. D + D (press the key twice) to delete the current cell.

How do I add a title to a cell in Jupyter Notebook?

Use the number sign (#) followed by a blank space for notebook titles and section headings: # for titles. ## for major headings. ### for subheadings.


1 Answers

Tagging is a fairly recent and perhaps not quite finished feature of jupyter-notebooks, added with version 5.0. From what I understand they are mostly meant for tools such as nbconvert (converts notebooks to other formats such as pdf) and nbval (validates notebooks) and other more or less integrated tools working with jupyter notebooks. Being able to add tags to a cell would enable different behaviours for such tools depending on a cells tag. Some example that could be accomplished with the ability to add tags would be:

  • nbconvert - hide a cell, hide the input leaving the output visible, collapse a cell leaving a way to reveal it
  • nbconvert to latex - markdown cell contains title (or subtitle, abstract...)
  • nbval - check/ignore output from a cell, skip executing a cell, expect a cell to raise an error
  • nbgrader - solution cell, tests cell
  • nbparameterise - cell contains input parameters.

as envisaged by takluyver over at jupyter's github. If you want more information on implementation and the discussion surrounding it you can read more here.

like image 149
Christian Eriksson Avatar answered Oct 06 '22 23:10

Christian Eriksson