Recommendations mentioned in How to hide one specific cell (input or output) in IPython Notebook? don't work.
On Windows I do the following
jupyter nbconvert a.ipynb --TagRemovePreprocessor.remove_cell_tags="{'remove_cell'}"
but get an error
traitlets.traitlets.TraitError: The 'remove_cell_tags' trait of a TagRemovePreprocessor instance must be a set, but a value of type 'unicode' (i.e. u"{'remove_cell'}") was specified.
I also tried '{"remove_cell"}'
I am using nbconvert 5.4.0
Any ideas how to do this?
Primarily, the nbconvert tool allows you to convert a Jupyter . ipynb notebook document file into another static format including HTML, LaTeX, PDF, Markdown, reStructuredText, and more. nbconvert can also add productivity to your workflow when used to execute notebooks programmatically.
“delete a cell in jupyter notebook” Code Answer's D+D(press the key twice when you are in command mode) to delete the selected cell.
The Jupyter Notebook ships with a cell tag editor by default. This lets you add cell tags to each cell quickly. To enable the cell tag editor, click View -> Cell Toolbar -> Tags . This will enable the tags UI.
Hide cell inputs If you add the tag hide-input to a cell, then Jupyter Book will hide the cell but display the outputs.
You need to enable the TagRemovePreprocessor before you call it.
The code below shows how to enable it and how to enclose your tags as a list so you can exclude more than one tag if you wish. To exclude a single tag, just put one element in the list eg ['remove_cell'].
The parameter --to html is not required if you are converting to html (as html is the default). If you want to convert to python, for example, change --to html to --to python
jupyter nbconvert a.ipynb --TagRemovePreprocessor.enabled=True --TagRemovePreprocessor.remove_cell_tags="['remove_cell', 'other_tag_to_remove']" --to html
Note that the TagRemovePreprocessor is only available in nbconvert 5.3 and above: https://nbconvert.readthedocs.io/en/latest/changelog.html?highlight=TagRemovePreprocessor
Needs some extra quoting to work:
--TagRemovePreprocessor.remove_cell_tags={\"remove_cell\"}
.
However beware of an ongoing issue with noteboot to notebook conversion - it seems like in this case preprocessors, including tag removal, do not run. See more in this SO question:
jupyter nbconvert --to notebook not excluding raw cells
Update: Not tested on windows, just on Linux
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With