Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter Notebook: command for hide the output of a cell?

In my notebook, I have a cell returning temp calculation results. It's a bit long, so after it is run, I want to hide it and when needed, to show it.

To do it manually, I can double click the left side of the output, to hide it

enter image description here

After double click enter image description here

But is there any way I can do this by code? For example,

the last line of the cell, use a command like %%hide output, and the output would be hidden after finished running.

Additionally, can I get this feature in output HTML?

like image 938
cqcn1991 Avatar asked May 11 '16 06:05

cqcn1991


People also ask

How do I hide cell output?

the last line of the cell, use a command like %%hide output , and the output would be hidden after finished running.

How do I get rid of output in Jupyter notebook?

Press 'control-shift-p', that opens the command palette. Then type 'clear cell output'. That will let you select the command to clear the output.

How do you hide the output in Jupyter notebook Vscode?

It seems to be that the shortcuts from jupyter notebook are integrated into the jupyter notebook in visual studio code. If you press "o" on a cell, it will hide the cell output.

How do you stop the execution of a cell in Jupyter notebook?

Stopping a process or restarting a Jupyter Notebook To interrupt a cell execution, you can click the ■ “stop” button in the ribbon above the notebook, or select “Interrupt Kernel” from the Kernel menue.


2 Answers

Add ; by the end of the cell to hide the output of that cell.

like image 72
Raniere Silva Avatar answered Sep 28 '22 08:09

Raniere Silva


In the newer versions(5.0.0 at the time I'm writing this), pressing o in the command mode hides the output of the cell in focus. The same happens if you triple click in front of the output.

o is

  • the first letter in the word "output" or
  • lower case of 15th letter in the alphabet
like image 32
Sundeep Avatar answered Sep 28 '22 09:09

Sundeep