How to hide one specific cell (input or output) in IPython Notebook?
Is there a way to selectively hide one specific input or output cell in IPython notebook?
I could only find the below code to show / hide all input cells.
http://blog.nextgenetics.net/?e=102
But what if I only want to hide the first input cell of a notebook?
ipython ipython-notebook
add a comment |
Is there a way to selectively hide one specific input or output cell in IPython notebook?
I could only find the below code to show / hide all input cells.
http://blog.nextgenetics.net/?e=102
But what if I only want to hide the first input cell of a notebook?
ipython ipython-notebook
it seems there is no easy way? I think it would be useful as sometimes you do want to hide some of the cells that is too long or not especially relevant to the context.
– Pan Yan
Jul 24 '15 at 0:02
1
Answering for folks in 2018. You could switch to Jupyter Lab. There's a hover-over tool that shows up on the left hand side of the cell (Both code and output), clicking which folds that cell
– Lelouch Lamperouge
Feb 20 '18 at 22:31
add a comment |
Is there a way to selectively hide one specific input or output cell in IPython notebook?
I could only find the below code to show / hide all input cells.
http://blog.nextgenetics.net/?e=102
But what if I only want to hide the first input cell of a notebook?
ipython ipython-notebook
Is there a way to selectively hide one specific input or output cell in IPython notebook?
I could only find the below code to show / hide all input cells.
http://blog.nextgenetics.net/?e=102
But what if I only want to hide the first input cell of a notebook?
ipython ipython-notebook
ipython ipython-notebook
edited Jul 21 '15 at 18:54
Alex Riley
77.3k21156161
77.3k21156161
asked Jul 20 '15 at 12:58
Pan Yan
5361315
5361315
it seems there is no easy way? I think it would be useful as sometimes you do want to hide some of the cells that is too long or not especially relevant to the context.
– Pan Yan
Jul 24 '15 at 0:02
1
Answering for folks in 2018. You could switch to Jupyter Lab. There's a hover-over tool that shows up on the left hand side of the cell (Both code and output), clicking which folds that cell
– Lelouch Lamperouge
Feb 20 '18 at 22:31
add a comment |
it seems there is no easy way? I think it would be useful as sometimes you do want to hide some of the cells that is too long or not especially relevant to the context.
– Pan Yan
Jul 24 '15 at 0:02
1
Answering for folks in 2018. You could switch to Jupyter Lab. There's a hover-over tool that shows up on the left hand side of the cell (Both code and output), clicking which folds that cell
– Lelouch Lamperouge
Feb 20 '18 at 22:31
it seems there is no easy way? I think it would be useful as sometimes you do want to hide some of the cells that is too long or not especially relevant to the context.
– Pan Yan
Jul 24 '15 at 0:02
it seems there is no easy way? I think it would be useful as sometimes you do want to hide some of the cells that is too long or not especially relevant to the context.
– Pan Yan
Jul 24 '15 at 0:02
1
1
Answering for folks in 2018. You could switch to Jupyter Lab. There's a hover-over tool that shows up on the left hand side of the cell (Both code and output), clicking which folds that cell
– Lelouch Lamperouge
Feb 20 '18 at 22:31
Answering for folks in 2018. You could switch to Jupyter Lab. There's a hover-over tool that shows up on the left hand side of the cell (Both code and output), clicking which folds that cell
– Lelouch Lamperouge
Feb 20 '18 at 22:31
add a comment |
9 Answers
9
active
oldest
votes
This is now built into nbconvert (as of 5.3.0) using tags.
Here's an example removing a specific cell from the output. Using this notebook. The example has three cells: a markdown cell, a code cell that will be hidden, and a code cell that will not be hidden.
- Add the
remove_celltag to any cells you want to hide using the tag editor built into the notebook or JupyterLab (the specific name "remove_cell" doesn't matter)
Convert with nbconvert
jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags='{"remove_cell"}'
Any cells with the tag remove_cell will be removed from the output.

In addition to entire cells, you can filter just inputs or just outputs:
TagRemovePreprocessor.remove_input_tagsTagRemovePreprocessor.remove_single_output_tagsTagRemovePreprocessor.remove_all_outputs_tags
2
Thanks for this. Does it however only work for html output? Nothing seems to be hidden in the resulting .ipynb file if usingjupyter nbconvert --to notebook --inplace ....
– immarried
Jan 29 '18 at 2:56
I had to swap the quotes on Windows; e.g.:jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags="{'a', 'b'}".
– Ninjakannon
Sep 9 '18 at 18:47
add a comment |
Here's a method that allows you to hide cells from the HTML/PDF output by editing the cell metadata only.
Versions I'm using:
$ jupyter notebook --version
4.1.0
$ jupyter nbconvert --version
4.2.0
- Download the ipython notebook extension templates by following install instructions on Github: pip install https://github.com/ipython-contrib/IPython-notebook-extensions/tarball/master
- This just install files into your local jupyter data directory. Full details in the readme
- This just install files into your local jupyter data directory. Full details in the readme
- run
jupyter notebook
- go to
localhost:8888/nbextensions(or whatever port you started on) and activatePrintview
- go back to
localhost:8888/tree, create a new notebook and go into it - create a code cell with some code in it that produces output e.g.
print("You can see me") #but not me
- go to
View>Cell Toolbar>Edit Metadata
- click the
Edit Metadatabutton now showing to the top right of the cell - add
'hide_input':Trueto the json e.g. mine looked like{after
"collapsed": false,
"hide_input": true,
"trusted": true
} - save notebook
- go back to the terminal and execute
jupyter nbconvert --to pdf --template printviewlatex.tplx notebookname.ipynb(if your notebook is callednotebookname.ipynb.ipynb)
You should now have a document called notebookname.pdf in the directory. Hopefully it should have just the text You can see me in it...fingers crossed.
Good details. Bad process: too heavyweight. Is there not an annotation we can put in the cell itself? This process is unwieldy
– javadba
Dec 26 '18 at 20:24
add a comment |
Your solution for hiding all input cells can be altered to affect just a single cell.
Change 'div.input' to 'div.cell.code_cell.rendered.selected div.input'.
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
To show/hide this cell's raw code input, click <a href="javascript:code_toggle()">here</a>.''')
This works because when you click the "click here" prompt on a cell's output, that cell becomes the "selected" cell and thus becomes hidden.
If your JavaScript code executes a toggle within the <script></script> tags with a line of code like this
$( document ).ready(code_toggle);
then the block will automatically ("by default") be hidden when the input cell is executed.
Keep in mind that if you do make cell inputs hidden by default, you must run the cell with the Run Cells (Ctrl+Return) option, not the Run Cells and Select/Insert Below options.
These will prompt the move of the "selected" label to the next cell before executing the JavaScript, so you may end up hiding a cell that doesn't have the "click here" toggle link in its output. In which case you will have to inspect the cell and navigate through the relevant tags and change display='none'; to display='block';.
Note that this must be put at the end of any code in your cell, and that you need to have imported HTML from IPython.display before executing this code. You can do so by executing
from IPython.display import HTML
I'm using this solution. I have it hidden, but then when I export as html the code is displayed. How can I export the notebook without displaying that specific cell?
– nahusznaj
Jun 1 '18 at 15:24
add a comment |
In Jupiter notebook, there is also an option on the bar:

You can Clear the output or you can hide it using Toggle. In both cases you won't delete any variable calculated inside the cell.
add a comment |
This is an extension of Mathmagician's answer, which enables you to:
- toggle just a single cell (the JS function name has a random suffix, so if used more than one time, it would not conflict with other usages)
- toggle the cell below the current cell - this is super handy in RISE presentations where you may want to show the code, but then hide it to display its output

What you need to do is run the following code first to define the hide_toggle function:
from IPython.display import HTML
import random
def hide_toggle(for_next=False):
this_cell = """$('div.cell.code_cell.rendered.selected')"""
next_cell = this_cell + '.next()'
toggle_text = 'Toggle show/hide' # text shown on toggle link
target_cell = this_cell # target cell to control with toggle
js_hide_current = '' # bit of JS to permanently hide code in current cell (only when toggling next cell)
if for_next:
target_cell = next_cell
toggle_text += ' next cell'
js_hide_current = this_cell + '.find("div.input").hide();'
js_f_name = 'code_toggle_{}'.format(str(random.randint(1,2**64)))
html = """
<script>
function {f_name}() {{
{cell_selector}.find('div.input').toggle();
}}
{js_hide_current}
</script>
<a href="javascript:{f_name}()">{toggle_text}</a>
""".format(
f_name=js_f_name,
cell_selector=target_cell,
js_hide_current=js_hide_current,
toggle_text=toggle_text
)
return HTML(html)
And then use it in cells like this:
x = 1
y = 2
print('Result is {} + {}'.format(x, y))
hide_toggle()
Or this (if you want to toggle the next cell)
hide_toggle(for_next=True)
Thank you, works very well.
– mit
Oct 5 '18 at 17:00
Minimal python version seems to be 3.6 for the above code. Will work below 3.6 for anyone who converts the two f-stringsf' ....'to old style
– mit
Oct 5 '18 at 17:05
1
Ah right, thanks, I changed it now to the backward compatible way of string formatting
– Ferrard
Oct 11 '18 at 12:24
add a comment |
Ok, after trying without success the answers here stated. I found this extension of kirbs.Hide_code nbextension It works just fine. But it is recommended to do the following:
First of all, make sure that you have updated your jupyter, the nbconverter, the nbconverter extensiones and the jupyter serverextension. If you did that then you can do the following in the anaconda prompt (Opened with admin priviledges):
pip install hide_codejupyter nbextension install --py hide_codejupyter nbextension enable --py hide_codejupyter serverextension enable --py hide_code
Finally if you are using anaconda distribution to open your notebooks then make sure of also using these commands:
jupyter nbextension install --sys-prefix --py hide_codejupyter nbextension enable --sys-prefix --py hide_codejupyter serverextension enable --sys-prefix --py hide_code
If there are no error on the execution of these commands then you will be able to see and use the hide code options in the toolbar as it is shown here:
Hide_code toolbar
Done! If you use the button for exporting and voilá!
Export Button
Good luck
add a comment |
The @Mathmagician solution is almost perfect, but has many side effects.
More correct would be like:
from IPython.core.display import display, HTML
toggle_code_str = '''
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Toggle Code"></form>
'''
toggle_code_prepare_str = '''
<script>
function code_toggle() {
if ($('div.cell.code_cell.rendered.selected div.input').css('display')!='none'){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
}
</script>
'''
display(HTML(toggle_code_prepare_str + toggle_code_str))
def toggle_code():
display(HTML(toggle_code_str))
The call toggle_code than may be placed in some code cell before other code, so if code in the cell is executed slowly, won't be side effects. Also it solves the problem with Run Cells and Select/Insert Below
It adds the toggle button, but the initial state can't be managed
add a comment |
In case anyone finds excluding all code cells helpful (which is not what is asked here), you can add this flag nbconvert --TemplateExporter.exclude_code_cell=True
add a comment |
Finally found it's possible using this extension.
https://github.com/ipython-contrib/IPython-notebook-extensions/blob/master/usability/hide_input.js
Update: This seems to have been merged to github.com/ipython-contrib/IPython-notebook-extensions
– Hans
Apr 28 '16 at 12:20
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31517194%2fhow-to-hide-one-specific-cell-input-or-output-in-ipython-notebook%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is now built into nbconvert (as of 5.3.0) using tags.
Here's an example removing a specific cell from the output. Using this notebook. The example has three cells: a markdown cell, a code cell that will be hidden, and a code cell that will not be hidden.
- Add the
remove_celltag to any cells you want to hide using the tag editor built into the notebook or JupyterLab (the specific name "remove_cell" doesn't matter)
Convert with nbconvert
jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags='{"remove_cell"}'
Any cells with the tag remove_cell will be removed from the output.

In addition to entire cells, you can filter just inputs or just outputs:
TagRemovePreprocessor.remove_input_tagsTagRemovePreprocessor.remove_single_output_tagsTagRemovePreprocessor.remove_all_outputs_tags
2
Thanks for this. Does it however only work for html output? Nothing seems to be hidden in the resulting .ipynb file if usingjupyter nbconvert --to notebook --inplace ....
– immarried
Jan 29 '18 at 2:56
I had to swap the quotes on Windows; e.g.:jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags="{'a', 'b'}".
– Ninjakannon
Sep 9 '18 at 18:47
add a comment |
This is now built into nbconvert (as of 5.3.0) using tags.
Here's an example removing a specific cell from the output. Using this notebook. The example has three cells: a markdown cell, a code cell that will be hidden, and a code cell that will not be hidden.
- Add the
remove_celltag to any cells you want to hide using the tag editor built into the notebook or JupyterLab (the specific name "remove_cell" doesn't matter)
Convert with nbconvert
jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags='{"remove_cell"}'
Any cells with the tag remove_cell will be removed from the output.

In addition to entire cells, you can filter just inputs or just outputs:
TagRemovePreprocessor.remove_input_tagsTagRemovePreprocessor.remove_single_output_tagsTagRemovePreprocessor.remove_all_outputs_tags
2
Thanks for this. Does it however only work for html output? Nothing seems to be hidden in the resulting .ipynb file if usingjupyter nbconvert --to notebook --inplace ....
– immarried
Jan 29 '18 at 2:56
I had to swap the quotes on Windows; e.g.:jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags="{'a', 'b'}".
– Ninjakannon
Sep 9 '18 at 18:47
add a comment |
This is now built into nbconvert (as of 5.3.0) using tags.
Here's an example removing a specific cell from the output. Using this notebook. The example has three cells: a markdown cell, a code cell that will be hidden, and a code cell that will not be hidden.
- Add the
remove_celltag to any cells you want to hide using the tag editor built into the notebook or JupyterLab (the specific name "remove_cell" doesn't matter)
Convert with nbconvert
jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags='{"remove_cell"}'
Any cells with the tag remove_cell will be removed from the output.

In addition to entire cells, you can filter just inputs or just outputs:
TagRemovePreprocessor.remove_input_tagsTagRemovePreprocessor.remove_single_output_tagsTagRemovePreprocessor.remove_all_outputs_tags
This is now built into nbconvert (as of 5.3.0) using tags.
Here's an example removing a specific cell from the output. Using this notebook. The example has three cells: a markdown cell, a code cell that will be hidden, and a code cell that will not be hidden.
- Add the
remove_celltag to any cells you want to hide using the tag editor built into the notebook or JupyterLab (the specific name "remove_cell" doesn't matter)
Convert with nbconvert
jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags='{"remove_cell"}'
Any cells with the tag remove_cell will be removed from the output.

In addition to entire cells, you can filter just inputs or just outputs:
TagRemovePreprocessor.remove_input_tagsTagRemovePreprocessor.remove_single_output_tagsTagRemovePreprocessor.remove_all_outputs_tags
answered Jan 3 '18 at 19:37
TomAugspurger
15k35055
15k35055
2
Thanks for this. Does it however only work for html output? Nothing seems to be hidden in the resulting .ipynb file if usingjupyter nbconvert --to notebook --inplace ....
– immarried
Jan 29 '18 at 2:56
I had to swap the quotes on Windows; e.g.:jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags="{'a', 'b'}".
– Ninjakannon
Sep 9 '18 at 18:47
add a comment |
2
Thanks for this. Does it however only work for html output? Nothing seems to be hidden in the resulting .ipynb file if usingjupyter nbconvert --to notebook --inplace ....
– immarried
Jan 29 '18 at 2:56
I had to swap the quotes on Windows; e.g.:jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags="{'a', 'b'}".
– Ninjakannon
Sep 9 '18 at 18:47
2
2
Thanks for this. Does it however only work for html output? Nothing seems to be hidden in the resulting .ipynb file if using
jupyter nbconvert --to notebook --inplace ....– immarried
Jan 29 '18 at 2:56
Thanks for this. Does it however only work for html output? Nothing seems to be hidden in the resulting .ipynb file if using
jupyter nbconvert --to notebook --inplace ....– immarried
Jan 29 '18 at 2:56
I had to swap the quotes on Windows; e.g.:
jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags="{'a', 'b'}".– Ninjakannon
Sep 9 '18 at 18:47
I had to swap the quotes on Windows; e.g.:
jupyter nbconvert nbconvert-example.ipynb --TagRemovePreprocessor.remove_cell_tags="{'a', 'b'}".– Ninjakannon
Sep 9 '18 at 18:47
add a comment |
Here's a method that allows you to hide cells from the HTML/PDF output by editing the cell metadata only.
Versions I'm using:
$ jupyter notebook --version
4.1.0
$ jupyter nbconvert --version
4.2.0
- Download the ipython notebook extension templates by following install instructions on Github: pip install https://github.com/ipython-contrib/IPython-notebook-extensions/tarball/master
- This just install files into your local jupyter data directory. Full details in the readme
- This just install files into your local jupyter data directory. Full details in the readme
- run
jupyter notebook
- go to
localhost:8888/nbextensions(or whatever port you started on) and activatePrintview
- go back to
localhost:8888/tree, create a new notebook and go into it - create a code cell with some code in it that produces output e.g.
print("You can see me") #but not me
- go to
View>Cell Toolbar>Edit Metadata
- click the
Edit Metadatabutton now showing to the top right of the cell - add
'hide_input':Trueto the json e.g. mine looked like{after
"collapsed": false,
"hide_input": true,
"trusted": true
} - save notebook
- go back to the terminal and execute
jupyter nbconvert --to pdf --template printviewlatex.tplx notebookname.ipynb(if your notebook is callednotebookname.ipynb.ipynb)
You should now have a document called notebookname.pdf in the directory. Hopefully it should have just the text You can see me in it...fingers crossed.
Good details. Bad process: too heavyweight. Is there not an annotation we can put in the cell itself? This process is unwieldy
– javadba
Dec 26 '18 at 20:24
add a comment |
Here's a method that allows you to hide cells from the HTML/PDF output by editing the cell metadata only.
Versions I'm using:
$ jupyter notebook --version
4.1.0
$ jupyter nbconvert --version
4.2.0
- Download the ipython notebook extension templates by following install instructions on Github: pip install https://github.com/ipython-contrib/IPython-notebook-extensions/tarball/master
- This just install files into your local jupyter data directory. Full details in the readme
- This just install files into your local jupyter data directory. Full details in the readme
- run
jupyter notebook
- go to
localhost:8888/nbextensions(or whatever port you started on) and activatePrintview
- go back to
localhost:8888/tree, create a new notebook and go into it - create a code cell with some code in it that produces output e.g.
print("You can see me") #but not me
- go to
View>Cell Toolbar>Edit Metadata
- click the
Edit Metadatabutton now showing to the top right of the cell - add
'hide_input':Trueto the json e.g. mine looked like{after
"collapsed": false,
"hide_input": true,
"trusted": true
} - save notebook
- go back to the terminal and execute
jupyter nbconvert --to pdf --template printviewlatex.tplx notebookname.ipynb(if your notebook is callednotebookname.ipynb.ipynb)
You should now have a document called notebookname.pdf in the directory. Hopefully it should have just the text You can see me in it...fingers crossed.
Good details. Bad process: too heavyweight. Is there not an annotation we can put in the cell itself? This process is unwieldy
– javadba
Dec 26 '18 at 20:24
add a comment |
Here's a method that allows you to hide cells from the HTML/PDF output by editing the cell metadata only.
Versions I'm using:
$ jupyter notebook --version
4.1.0
$ jupyter nbconvert --version
4.2.0
- Download the ipython notebook extension templates by following install instructions on Github: pip install https://github.com/ipython-contrib/IPython-notebook-extensions/tarball/master
- This just install files into your local jupyter data directory. Full details in the readme
- This just install files into your local jupyter data directory. Full details in the readme
- run
jupyter notebook
- go to
localhost:8888/nbextensions(or whatever port you started on) and activatePrintview
- go back to
localhost:8888/tree, create a new notebook and go into it - create a code cell with some code in it that produces output e.g.
print("You can see me") #but not me
- go to
View>Cell Toolbar>Edit Metadata
- click the
Edit Metadatabutton now showing to the top right of the cell - add
'hide_input':Trueto the json e.g. mine looked like{after
"collapsed": false,
"hide_input": true,
"trusted": true
} - save notebook
- go back to the terminal and execute
jupyter nbconvert --to pdf --template printviewlatex.tplx notebookname.ipynb(if your notebook is callednotebookname.ipynb.ipynb)
You should now have a document called notebookname.pdf in the directory. Hopefully it should have just the text You can see me in it...fingers crossed.
Here's a method that allows you to hide cells from the HTML/PDF output by editing the cell metadata only.
Versions I'm using:
$ jupyter notebook --version
4.1.0
$ jupyter nbconvert --version
4.2.0
- Download the ipython notebook extension templates by following install instructions on Github: pip install https://github.com/ipython-contrib/IPython-notebook-extensions/tarball/master
- This just install files into your local jupyter data directory. Full details in the readme
- This just install files into your local jupyter data directory. Full details in the readme
- run
jupyter notebook
- go to
localhost:8888/nbextensions(or whatever port you started on) and activatePrintview
- go back to
localhost:8888/tree, create a new notebook and go into it - create a code cell with some code in it that produces output e.g.
print("You can see me") #but not me
- go to
View>Cell Toolbar>Edit Metadata
- click the
Edit Metadatabutton now showing to the top right of the cell - add
'hide_input':Trueto the json e.g. mine looked like{after
"collapsed": false,
"hide_input": true,
"trusted": true
} - save notebook
- go back to the terminal and execute
jupyter nbconvert --to pdf --template printviewlatex.tplx notebookname.ipynb(if your notebook is callednotebookname.ipynb.ipynb)
You should now have a document called notebookname.pdf in the directory. Hopefully it should have just the text You can see me in it...fingers crossed.
answered Jun 26 '16 at 16:13
kungfujam
3,72363351
3,72363351
Good details. Bad process: too heavyweight. Is there not an annotation we can put in the cell itself? This process is unwieldy
– javadba
Dec 26 '18 at 20:24
add a comment |
Good details. Bad process: too heavyweight. Is there not an annotation we can put in the cell itself? This process is unwieldy
– javadba
Dec 26 '18 at 20:24
Good details. Bad process: too heavyweight. Is there not an annotation we can put in the cell itself? This process is unwieldy
– javadba
Dec 26 '18 at 20:24
Good details. Bad process: too heavyweight. Is there not an annotation we can put in the cell itself? This process is unwieldy
– javadba
Dec 26 '18 at 20:24
add a comment |
Your solution for hiding all input cells can be altered to affect just a single cell.
Change 'div.input' to 'div.cell.code_cell.rendered.selected div.input'.
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
To show/hide this cell's raw code input, click <a href="javascript:code_toggle()">here</a>.''')
This works because when you click the "click here" prompt on a cell's output, that cell becomes the "selected" cell and thus becomes hidden.
If your JavaScript code executes a toggle within the <script></script> tags with a line of code like this
$( document ).ready(code_toggle);
then the block will automatically ("by default") be hidden when the input cell is executed.
Keep in mind that if you do make cell inputs hidden by default, you must run the cell with the Run Cells (Ctrl+Return) option, not the Run Cells and Select/Insert Below options.
These will prompt the move of the "selected" label to the next cell before executing the JavaScript, so you may end up hiding a cell that doesn't have the "click here" toggle link in its output. In which case you will have to inspect the cell and navigate through the relevant tags and change display='none'; to display='block';.
Note that this must be put at the end of any code in your cell, and that you need to have imported HTML from IPython.display before executing this code. You can do so by executing
from IPython.display import HTML
I'm using this solution. I have it hidden, but then when I export as html the code is displayed. How can I export the notebook without displaying that specific cell?
– nahusznaj
Jun 1 '18 at 15:24
add a comment |
Your solution for hiding all input cells can be altered to affect just a single cell.
Change 'div.input' to 'div.cell.code_cell.rendered.selected div.input'.
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
To show/hide this cell's raw code input, click <a href="javascript:code_toggle()">here</a>.''')
This works because when you click the "click here" prompt on a cell's output, that cell becomes the "selected" cell and thus becomes hidden.
If your JavaScript code executes a toggle within the <script></script> tags with a line of code like this
$( document ).ready(code_toggle);
then the block will automatically ("by default") be hidden when the input cell is executed.
Keep in mind that if you do make cell inputs hidden by default, you must run the cell with the Run Cells (Ctrl+Return) option, not the Run Cells and Select/Insert Below options.
These will prompt the move of the "selected" label to the next cell before executing the JavaScript, so you may end up hiding a cell that doesn't have the "click here" toggle link in its output. In which case you will have to inspect the cell and navigate through the relevant tags and change display='none'; to display='block';.
Note that this must be put at the end of any code in your cell, and that you need to have imported HTML from IPython.display before executing this code. You can do so by executing
from IPython.display import HTML
I'm using this solution. I have it hidden, but then when I export as html the code is displayed. How can I export the notebook without displaying that specific cell?
– nahusznaj
Jun 1 '18 at 15:24
add a comment |
Your solution for hiding all input cells can be altered to affect just a single cell.
Change 'div.input' to 'div.cell.code_cell.rendered.selected div.input'.
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
To show/hide this cell's raw code input, click <a href="javascript:code_toggle()">here</a>.''')
This works because when you click the "click here" prompt on a cell's output, that cell becomes the "selected" cell and thus becomes hidden.
If your JavaScript code executes a toggle within the <script></script> tags with a line of code like this
$( document ).ready(code_toggle);
then the block will automatically ("by default") be hidden when the input cell is executed.
Keep in mind that if you do make cell inputs hidden by default, you must run the cell with the Run Cells (Ctrl+Return) option, not the Run Cells and Select/Insert Below options.
These will prompt the move of the "selected" label to the next cell before executing the JavaScript, so you may end up hiding a cell that doesn't have the "click here" toggle link in its output. In which case you will have to inspect the cell and navigate through the relevant tags and change display='none'; to display='block';.
Note that this must be put at the end of any code in your cell, and that you need to have imported HTML from IPython.display before executing this code. You can do so by executing
from IPython.display import HTML
Your solution for hiding all input cells can be altered to affect just a single cell.
Change 'div.input' to 'div.cell.code_cell.rendered.selected div.input'.
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
To show/hide this cell's raw code input, click <a href="javascript:code_toggle()">here</a>.''')
This works because when you click the "click here" prompt on a cell's output, that cell becomes the "selected" cell and thus becomes hidden.
If your JavaScript code executes a toggle within the <script></script> tags with a line of code like this
$( document ).ready(code_toggle);
then the block will automatically ("by default") be hidden when the input cell is executed.
Keep in mind that if you do make cell inputs hidden by default, you must run the cell with the Run Cells (Ctrl+Return) option, not the Run Cells and Select/Insert Below options.
These will prompt the move of the "selected" label to the next cell before executing the JavaScript, so you may end up hiding a cell that doesn't have the "click here" toggle link in its output. In which case you will have to inspect the cell and navigate through the relevant tags and change display='none'; to display='block';.
Note that this must be put at the end of any code in your cell, and that you need to have imported HTML from IPython.display before executing this code. You can do so by executing
from IPython.display import HTML
edited Oct 25 '16 at 9:57
answered Oct 18 '16 at 11:10
Mathmagician
7714
7714
I'm using this solution. I have it hidden, but then when I export as html the code is displayed. How can I export the notebook without displaying that specific cell?
– nahusznaj
Jun 1 '18 at 15:24
add a comment |
I'm using this solution. I have it hidden, but then when I export as html the code is displayed. How can I export the notebook without displaying that specific cell?
– nahusznaj
Jun 1 '18 at 15:24
I'm using this solution. I have it hidden, but then when I export as html the code is displayed. How can I export the notebook without displaying that specific cell?
– nahusznaj
Jun 1 '18 at 15:24
I'm using this solution. I have it hidden, but then when I export as html the code is displayed. How can I export the notebook without displaying that specific cell?
– nahusznaj
Jun 1 '18 at 15:24
add a comment |
In Jupiter notebook, there is also an option on the bar:

You can Clear the output or you can hide it using Toggle. In both cases you won't delete any variable calculated inside the cell.
add a comment |
In Jupiter notebook, there is also an option on the bar:

You can Clear the output or you can hide it using Toggle. In both cases you won't delete any variable calculated inside the cell.
add a comment |
In Jupiter notebook, there is also an option on the bar:

You can Clear the output or you can hide it using Toggle. In both cases you won't delete any variable calculated inside the cell.
In Jupiter notebook, there is also an option on the bar:

You can Clear the output or you can hide it using Toggle. In both cases you won't delete any variable calculated inside the cell.
answered Aug 23 '17 at 10:26
G M
5,56153745
5,56153745
add a comment |
add a comment |
This is an extension of Mathmagician's answer, which enables you to:
- toggle just a single cell (the JS function name has a random suffix, so if used more than one time, it would not conflict with other usages)
- toggle the cell below the current cell - this is super handy in RISE presentations where you may want to show the code, but then hide it to display its output

What you need to do is run the following code first to define the hide_toggle function:
from IPython.display import HTML
import random
def hide_toggle(for_next=False):
this_cell = """$('div.cell.code_cell.rendered.selected')"""
next_cell = this_cell + '.next()'
toggle_text = 'Toggle show/hide' # text shown on toggle link
target_cell = this_cell # target cell to control with toggle
js_hide_current = '' # bit of JS to permanently hide code in current cell (only when toggling next cell)
if for_next:
target_cell = next_cell
toggle_text += ' next cell'
js_hide_current = this_cell + '.find("div.input").hide();'
js_f_name = 'code_toggle_{}'.format(str(random.randint(1,2**64)))
html = """
<script>
function {f_name}() {{
{cell_selector}.find('div.input').toggle();
}}
{js_hide_current}
</script>
<a href="javascript:{f_name}()">{toggle_text}</a>
""".format(
f_name=js_f_name,
cell_selector=target_cell,
js_hide_current=js_hide_current,
toggle_text=toggle_text
)
return HTML(html)
And then use it in cells like this:
x = 1
y = 2
print('Result is {} + {}'.format(x, y))
hide_toggle()
Or this (if you want to toggle the next cell)
hide_toggle(for_next=True)
Thank you, works very well.
– mit
Oct 5 '18 at 17:00
Minimal python version seems to be 3.6 for the above code. Will work below 3.6 for anyone who converts the two f-stringsf' ....'to old style
– mit
Oct 5 '18 at 17:05
1
Ah right, thanks, I changed it now to the backward compatible way of string formatting
– Ferrard
Oct 11 '18 at 12:24
add a comment |
This is an extension of Mathmagician's answer, which enables you to:
- toggle just a single cell (the JS function name has a random suffix, so if used more than one time, it would not conflict with other usages)
- toggle the cell below the current cell - this is super handy in RISE presentations where you may want to show the code, but then hide it to display its output

What you need to do is run the following code first to define the hide_toggle function:
from IPython.display import HTML
import random
def hide_toggle(for_next=False):
this_cell = """$('div.cell.code_cell.rendered.selected')"""
next_cell = this_cell + '.next()'
toggle_text = 'Toggle show/hide' # text shown on toggle link
target_cell = this_cell # target cell to control with toggle
js_hide_current = '' # bit of JS to permanently hide code in current cell (only when toggling next cell)
if for_next:
target_cell = next_cell
toggle_text += ' next cell'
js_hide_current = this_cell + '.find("div.input").hide();'
js_f_name = 'code_toggle_{}'.format(str(random.randint(1,2**64)))
html = """
<script>
function {f_name}() {{
{cell_selector}.find('div.input').toggle();
}}
{js_hide_current}
</script>
<a href="javascript:{f_name}()">{toggle_text}</a>
""".format(
f_name=js_f_name,
cell_selector=target_cell,
js_hide_current=js_hide_current,
toggle_text=toggle_text
)
return HTML(html)
And then use it in cells like this:
x = 1
y = 2
print('Result is {} + {}'.format(x, y))
hide_toggle()
Or this (if you want to toggle the next cell)
hide_toggle(for_next=True)
Thank you, works very well.
– mit
Oct 5 '18 at 17:00
Minimal python version seems to be 3.6 for the above code. Will work below 3.6 for anyone who converts the two f-stringsf' ....'to old style
– mit
Oct 5 '18 at 17:05
1
Ah right, thanks, I changed it now to the backward compatible way of string formatting
– Ferrard
Oct 11 '18 at 12:24
add a comment |
This is an extension of Mathmagician's answer, which enables you to:
- toggle just a single cell (the JS function name has a random suffix, so if used more than one time, it would not conflict with other usages)
- toggle the cell below the current cell - this is super handy in RISE presentations where you may want to show the code, but then hide it to display its output

What you need to do is run the following code first to define the hide_toggle function:
from IPython.display import HTML
import random
def hide_toggle(for_next=False):
this_cell = """$('div.cell.code_cell.rendered.selected')"""
next_cell = this_cell + '.next()'
toggle_text = 'Toggle show/hide' # text shown on toggle link
target_cell = this_cell # target cell to control with toggle
js_hide_current = '' # bit of JS to permanently hide code in current cell (only when toggling next cell)
if for_next:
target_cell = next_cell
toggle_text += ' next cell'
js_hide_current = this_cell + '.find("div.input").hide();'
js_f_name = 'code_toggle_{}'.format(str(random.randint(1,2**64)))
html = """
<script>
function {f_name}() {{
{cell_selector}.find('div.input').toggle();
}}
{js_hide_current}
</script>
<a href="javascript:{f_name}()">{toggle_text}</a>
""".format(
f_name=js_f_name,
cell_selector=target_cell,
js_hide_current=js_hide_current,
toggle_text=toggle_text
)
return HTML(html)
And then use it in cells like this:
x = 1
y = 2
print('Result is {} + {}'.format(x, y))
hide_toggle()
Or this (if you want to toggle the next cell)
hide_toggle(for_next=True)
This is an extension of Mathmagician's answer, which enables you to:
- toggle just a single cell (the JS function name has a random suffix, so if used more than one time, it would not conflict with other usages)
- toggle the cell below the current cell - this is super handy in RISE presentations where you may want to show the code, but then hide it to display its output

What you need to do is run the following code first to define the hide_toggle function:
from IPython.display import HTML
import random
def hide_toggle(for_next=False):
this_cell = """$('div.cell.code_cell.rendered.selected')"""
next_cell = this_cell + '.next()'
toggle_text = 'Toggle show/hide' # text shown on toggle link
target_cell = this_cell # target cell to control with toggle
js_hide_current = '' # bit of JS to permanently hide code in current cell (only when toggling next cell)
if for_next:
target_cell = next_cell
toggle_text += ' next cell'
js_hide_current = this_cell + '.find("div.input").hide();'
js_f_name = 'code_toggle_{}'.format(str(random.randint(1,2**64)))
html = """
<script>
function {f_name}() {{
{cell_selector}.find('div.input').toggle();
}}
{js_hide_current}
</script>
<a href="javascript:{f_name}()">{toggle_text}</a>
""".format(
f_name=js_f_name,
cell_selector=target_cell,
js_hide_current=js_hide_current,
toggle_text=toggle_text
)
return HTML(html)
And then use it in cells like this:
x = 1
y = 2
print('Result is {} + {}'.format(x, y))
hide_toggle()
Or this (if you want to toggle the next cell)
hide_toggle(for_next=True)
edited Oct 11 '18 at 18:19
mit
6,03463360
6,03463360
answered Oct 5 '18 at 11:00
Ferrard
405511
405511
Thank you, works very well.
– mit
Oct 5 '18 at 17:00
Minimal python version seems to be 3.6 for the above code. Will work below 3.6 for anyone who converts the two f-stringsf' ....'to old style
– mit
Oct 5 '18 at 17:05
1
Ah right, thanks, I changed it now to the backward compatible way of string formatting
– Ferrard
Oct 11 '18 at 12:24
add a comment |
Thank you, works very well.
– mit
Oct 5 '18 at 17:00
Minimal python version seems to be 3.6 for the above code. Will work below 3.6 for anyone who converts the two f-stringsf' ....'to old style
– mit
Oct 5 '18 at 17:05
1
Ah right, thanks, I changed it now to the backward compatible way of string formatting
– Ferrard
Oct 11 '18 at 12:24
Thank you, works very well.
– mit
Oct 5 '18 at 17:00
Thank you, works very well.
– mit
Oct 5 '18 at 17:00
Minimal python version seems to be 3.6 for the above code. Will work below 3.6 for anyone who converts the two f-strings
f' ....' to old style– mit
Oct 5 '18 at 17:05
Minimal python version seems to be 3.6 for the above code. Will work below 3.6 for anyone who converts the two f-strings
f' ....' to old style– mit
Oct 5 '18 at 17:05
1
1
Ah right, thanks, I changed it now to the backward compatible way of string formatting
– Ferrard
Oct 11 '18 at 12:24
Ah right, thanks, I changed it now to the backward compatible way of string formatting
– Ferrard
Oct 11 '18 at 12:24
add a comment |
Ok, after trying without success the answers here stated. I found this extension of kirbs.Hide_code nbextension It works just fine. But it is recommended to do the following:
First of all, make sure that you have updated your jupyter, the nbconverter, the nbconverter extensiones and the jupyter serverextension. If you did that then you can do the following in the anaconda prompt (Opened with admin priviledges):
pip install hide_codejupyter nbextension install --py hide_codejupyter nbextension enable --py hide_codejupyter serverextension enable --py hide_code
Finally if you are using anaconda distribution to open your notebooks then make sure of also using these commands:
jupyter nbextension install --sys-prefix --py hide_codejupyter nbextension enable --sys-prefix --py hide_codejupyter serverextension enable --sys-prefix --py hide_code
If there are no error on the execution of these commands then you will be able to see and use the hide code options in the toolbar as it is shown here:
Hide_code toolbar
Done! If you use the button for exporting and voilá!
Export Button
Good luck
add a comment |
Ok, after trying without success the answers here stated. I found this extension of kirbs.Hide_code nbextension It works just fine. But it is recommended to do the following:
First of all, make sure that you have updated your jupyter, the nbconverter, the nbconverter extensiones and the jupyter serverextension. If you did that then you can do the following in the anaconda prompt (Opened with admin priviledges):
pip install hide_codejupyter nbextension install --py hide_codejupyter nbextension enable --py hide_codejupyter serverextension enable --py hide_code
Finally if you are using anaconda distribution to open your notebooks then make sure of also using these commands:
jupyter nbextension install --sys-prefix --py hide_codejupyter nbextension enable --sys-prefix --py hide_codejupyter serverextension enable --sys-prefix --py hide_code
If there are no error on the execution of these commands then you will be able to see and use the hide code options in the toolbar as it is shown here:
Hide_code toolbar
Done! If you use the button for exporting and voilá!
Export Button
Good luck
add a comment |
Ok, after trying without success the answers here stated. I found this extension of kirbs.Hide_code nbextension It works just fine. But it is recommended to do the following:
First of all, make sure that you have updated your jupyter, the nbconverter, the nbconverter extensiones and the jupyter serverextension. If you did that then you can do the following in the anaconda prompt (Opened with admin priviledges):
pip install hide_codejupyter nbextension install --py hide_codejupyter nbextension enable --py hide_codejupyter serverextension enable --py hide_code
Finally if you are using anaconda distribution to open your notebooks then make sure of also using these commands:
jupyter nbextension install --sys-prefix --py hide_codejupyter nbextension enable --sys-prefix --py hide_codejupyter serverextension enable --sys-prefix --py hide_code
If there are no error on the execution of these commands then you will be able to see and use the hide code options in the toolbar as it is shown here:
Hide_code toolbar
Done! If you use the button for exporting and voilá!
Export Button
Good luck
Ok, after trying without success the answers here stated. I found this extension of kirbs.Hide_code nbextension It works just fine. But it is recommended to do the following:
First of all, make sure that you have updated your jupyter, the nbconverter, the nbconverter extensiones and the jupyter serverextension. If you did that then you can do the following in the anaconda prompt (Opened with admin priviledges):
pip install hide_codejupyter nbextension install --py hide_codejupyter nbextension enable --py hide_codejupyter serverextension enable --py hide_code
Finally if you are using anaconda distribution to open your notebooks then make sure of also using these commands:
jupyter nbextension install --sys-prefix --py hide_codejupyter nbextension enable --sys-prefix --py hide_codejupyter serverextension enable --sys-prefix --py hide_code
If there are no error on the execution of these commands then you will be able to see and use the hide code options in the toolbar as it is shown here:
Hide_code toolbar
Done! If you use the button for exporting and voilá!
Export Button
Good luck
answered Dec 9 '18 at 17:59
F4laF
211
211
add a comment |
add a comment |
The @Mathmagician solution is almost perfect, but has many side effects.
More correct would be like:
from IPython.core.display import display, HTML
toggle_code_str = '''
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Toggle Code"></form>
'''
toggle_code_prepare_str = '''
<script>
function code_toggle() {
if ($('div.cell.code_cell.rendered.selected div.input').css('display')!='none'){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
}
</script>
'''
display(HTML(toggle_code_prepare_str + toggle_code_str))
def toggle_code():
display(HTML(toggle_code_str))
The call toggle_code than may be placed in some code cell before other code, so if code in the cell is executed slowly, won't be side effects. Also it solves the problem with Run Cells and Select/Insert Below
It adds the toggle button, but the initial state can't be managed
add a comment |
The @Mathmagician solution is almost perfect, but has many side effects.
More correct would be like:
from IPython.core.display import display, HTML
toggle_code_str = '''
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Toggle Code"></form>
'''
toggle_code_prepare_str = '''
<script>
function code_toggle() {
if ($('div.cell.code_cell.rendered.selected div.input').css('display')!='none'){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
}
</script>
'''
display(HTML(toggle_code_prepare_str + toggle_code_str))
def toggle_code():
display(HTML(toggle_code_str))
The call toggle_code than may be placed in some code cell before other code, so if code in the cell is executed slowly, won't be side effects. Also it solves the problem with Run Cells and Select/Insert Below
It adds the toggle button, but the initial state can't be managed
add a comment |
The @Mathmagician solution is almost perfect, but has many side effects.
More correct would be like:
from IPython.core.display import display, HTML
toggle_code_str = '''
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Toggle Code"></form>
'''
toggle_code_prepare_str = '''
<script>
function code_toggle() {
if ($('div.cell.code_cell.rendered.selected div.input').css('display')!='none'){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
}
</script>
'''
display(HTML(toggle_code_prepare_str + toggle_code_str))
def toggle_code():
display(HTML(toggle_code_str))
The call toggle_code than may be placed in some code cell before other code, so if code in the cell is executed slowly, won't be side effects. Also it solves the problem with Run Cells and Select/Insert Below
It adds the toggle button, but the initial state can't be managed
The @Mathmagician solution is almost perfect, but has many side effects.
More correct would be like:
from IPython.core.display import display, HTML
toggle_code_str = '''
<form action="javascript:code_toggle()"><input type="submit" id="toggleButton" value="Toggle Code"></form>
'''
toggle_code_prepare_str = '''
<script>
function code_toggle() {
if ($('div.cell.code_cell.rendered.selected div.input').css('display')!='none'){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {
$('div.cell.code_cell.rendered.selected div.input').show();
}
}
</script>
'''
display(HTML(toggle_code_prepare_str + toggle_code_str))
def toggle_code():
display(HTML(toggle_code_str))
The call toggle_code than may be placed in some code cell before other code, so if code in the cell is executed slowly, won't be side effects. Also it solves the problem with Run Cells and Select/Insert Below
It adds the toggle button, but the initial state can't be managed
edited Jul 24 '18 at 19:00
answered Jul 24 '18 at 18:18
Роман Коптев
545216
545216
add a comment |
add a comment |
In case anyone finds excluding all code cells helpful (which is not what is asked here), you can add this flag nbconvert --TemplateExporter.exclude_code_cell=True
add a comment |
In case anyone finds excluding all code cells helpful (which is not what is asked here), you can add this flag nbconvert --TemplateExporter.exclude_code_cell=True
add a comment |
In case anyone finds excluding all code cells helpful (which is not what is asked here), you can add this flag nbconvert --TemplateExporter.exclude_code_cell=True
In case anyone finds excluding all code cells helpful (which is not what is asked here), you can add this flag nbconvert --TemplateExporter.exclude_code_cell=True
edited Dec 27 '18 at 15:39
answered May 24 '18 at 21:22
shouldsee
30424
30424
add a comment |
add a comment |
Finally found it's possible using this extension.
https://github.com/ipython-contrib/IPython-notebook-extensions/blob/master/usability/hide_input.js
Update: This seems to have been merged to github.com/ipython-contrib/IPython-notebook-extensions
– Hans
Apr 28 '16 at 12:20
add a comment |
Finally found it's possible using this extension.
https://github.com/ipython-contrib/IPython-notebook-extensions/blob/master/usability/hide_input.js
Update: This seems to have been merged to github.com/ipython-contrib/IPython-notebook-extensions
– Hans
Apr 28 '16 at 12:20
add a comment |
Finally found it's possible using this extension.
https://github.com/ipython-contrib/IPython-notebook-extensions/blob/master/usability/hide_input.js
Finally found it's possible using this extension.
https://github.com/ipython-contrib/IPython-notebook-extensions/blob/master/usability/hide_input.js
answered Jul 25 '15 at 3:27
Pan Yan
5361315
5361315
Update: This seems to have been merged to github.com/ipython-contrib/IPython-notebook-extensions
– Hans
Apr 28 '16 at 12:20
add a comment |
Update: This seems to have been merged to github.com/ipython-contrib/IPython-notebook-extensions
– Hans
Apr 28 '16 at 12:20
Update: This seems to have been merged to github.com/ipython-contrib/IPython-notebook-extensions
– Hans
Apr 28 '16 at 12:20
Update: This seems to have been merged to github.com/ipython-contrib/IPython-notebook-extensions
– Hans
Apr 28 '16 at 12:20
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31517194%2fhow-to-hide-one-specific-cell-input-or-output-in-ipython-notebook%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
it seems there is no easy way? I think it would be useful as sometimes you do want to hide some of the cells that is too long or not especially relevant to the context.
– Pan Yan
Jul 24 '15 at 0:02
1
Answering for folks in 2018. You could switch to Jupyter Lab. There's a hover-over tool that shows up on the left hand side of the cell (Both code and output), clicking which folds that cell
– Lelouch Lamperouge
Feb 20 '18 at 22:31