collapse cell in jupyter notebook
UPDATE:
The newer jupyter-lab
is a more modern and feature-rich interface which supports cell folding by default. See @intsco's answer below
Original answer:
The jupyter contrib nbextensions
Python package contains a code-folding extension that can be enabled within the notebook. Follow the link (Github) for documentation.
To install using command line:
pip install jupyter_contrib_nbextensionsjupyter contrib nbextension install --user
To make life easier in managing them, I'd also recommend the jupyter nbextensions configurator
package. This provides an extra tab in your Notebook interface from where you can easily (de)activate all installed extensions.
Installation:
pip install jupyter_nbextensions_configuratorjupyter nbextensions_configurator enable --user
You can create a cell and put the following code in it:
%%html<style>div.input { display:none;}</style>
Running this cell will hide all input cells. To show them back, you can use the menu to clear all outputs.
Otherwise you can try notebook extensions like below:
https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/Home_3x