collapse cell in jupyter notebook
ipython, jupyter, jupyter-notebook, python
Solution
UPDATE:
The newer `jupyter-lab` is a more modern and feature-rich interface which supports cell folding by default. See @intsco's answer below
UPDATE 2
Since `jupyter-lab` now also supports extensions, you can extend the built-in cell-folding functionality with the `Collapsible_Headings` extension.
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_nbextensions
jupyter 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_configurator
jupyter nbextensions_configurator enable --user
Problem
I am using ipython Jupyter notebook. Let's say I defined a function that occupies a lot of space on my screen. Is there a way to collapse the cell? I want the function to remain executed and callable, yet I want to hide / collapse the cell in order to better visualize the notebook. How can I do this?