简体   繁体   中英

How to display a Jupyter notebook as dashboard?

I'd like to display an Jupyter (IPython) notebook as a (non-interactive) dashboard.

Coming from a regular notebook, the changes are:

  • displaying the notebook so it is not editable (like nbviewer.jupyter.org)

  • rerunning the notebook on a regular timer (like Kernel > Restart & Run All)

  • hiding the code (like jupyter_contrib_nbextensions "Hide input all", or something similar, but should be enabled by default when notebook loads)

  • (optional but nice) having multiple tabs or sections that the notebook can cycle through

What is the best way to do that? Is it better to do in a notebook, or convert the notebook to something that just generates a static html website? If notebook, how to set it up so it is not editable and so it gets rerun regularly?

You can generate HTML to embed into your dashboard. By using

--no-input

Exclude input cells and output prompts from converted document.

This mode is ideal for generating code-free reports.

Just run

jupyter nbconvert \
  --no-input \
  --to html
  --execute test.ipynb 

You can even generate a default config file with

jupyter nbconvert --generate-config

then set

## This allows you to exclude code cell inputs from all templates if set to True.
c.TemplateExporter.exclude_input = True

together with

## This allows you to exclude output prompts from all templates if set to True.
c.TemplateExporter.exclude_output_prompt = True

You can use a custom config by

--config=<Full path of a config file>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM