Questions tagged [jupyter-notebook]
The Jupyter Notebook is a web application that provides a frontend to many different languages and interactive shells such as IPython. Jupyter Notebook, unlike its predecessor IPython Notebook, supports many different languages and interactive shells in addition to Python and IPython. DO NOT use this tag on questions regarding code which merely happens to be written using Jupyter Notebooks, use the appropriate language tag instead, e.g. [python], [r].
jupyter-notebook
25,171
questions
950
votes
11
answers
1.4m
views
How to make IPython notebook matplotlib plot inline
I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0.
I cannot get matplotlib graphics to show up inline.
import matplotlib
import numpy as np
import matplotlib.pyplot ...
948
votes
12
answers
1.0m
views
Purpose of "%matplotlib inline"
What exactly is the use of %matplotlib inline?
647
votes
23
answers
90k
views
Using IPython / Jupyter Notebooks Under Version Control
What is a good strategy for keeping IPython notebooks under version control?
The notebook format is quite amenable for version control: if one wants to version control the notebook and the outputs ...
585
votes
26
answers
606k
views
Conda environments not showing up in Jupyter Notebook
I installed Anaconda (with Python 2.7), and installed Tensorflow in an environment called tensorflow. I can import Tensorflow successfully in that environment.
The problem is that Jupyter Notebook ...
562
votes
16
answers
425k
views
How do I increase the cell width of the Jupyter/ipython notebook in my browser?
I would like to increase the width of the ipython notebook in my browser. I have a high-resolution screen, and I would like to expand the cell width/size to make use of this extra space.
Thanks!
537
votes
39
answers
1.0m
views
How to change the Jupyter start-up folder
I tried following the instructions given on the Jupyter Notebook documentation.
Unfortunately, I haven't been able to figure it out. Where exactly is this "start in" field?
I've a windows 7 (64 bit) ...
516
votes
19
answers
805k
views
Change the Theme in Jupyter Notebook?
I like dark themes. However, the default theme of Jupyter notebooks is light, and I can't find the option to change the theme/background-color. How is this done?
505
votes
20
answers
832k
views
How to embed image or picture in jupyter notebook, either from a local machine or from a web resource?
I would like to include image in a jupyter notebook.
If I did the following, it works :
from IPython.display import Image
Image("img/picture.png")
But I would like to include the images in a ...
475
votes
8
answers
358k
views
What is the difference between Jupyter Notebook and JupyterLab?
I am new to Jupyter Notebook, what is the key difference between the Jupyter Notebook and JupyterLab, suggest me to choose the best one, which should be used in future.
433
votes
20
answers
482k
views
How do I convert a IPython Notebook into a Python file via commandline?
I'm looking at using the *.ipynb files as the source of truth and programmatically 'compiling' them into .py files for scheduled jobs/tasks.
The only way I understand to do this is via the GUI. Is ...
422
votes
10
answers
523k
views
How to make inline plots in Jupyter Notebook larger? [duplicate]
I have made my plots inline on my Ipython Notebook with "%matplotlib inline."
Now, the plot appears. However, it is very small. Is there a way to make it appear larger using either notebook ...
384
votes
21
answers
386k
views
Jupyter Notebook not saving: '_xsrf' argument missing from post
I've been running a script on jupyter notebooks for about 26 hour; I haven't really been using my computer for anything else, but it needs to run this program that will take ~30 hours to complete. At ...
378
votes
25
answers
571k
views
How do I add python3 kernel to jupyter (IPython)
My Jupyter notebooks installed with python 2 kernel. I do not understand why. I might have messed something up when I did the install. I already have python 3 installed. How can I add it to Jupyter?
...
367
votes
15
answers
470k
views
How to write LaTeX in IPython Notebook?
How can I display LaTeX code in a IPython Notebook?
366
votes
18
answers
584k
views
How do I block comment in Jupyter notebook? [closed]
I want to comment out a block of multiple lines in Jupyter Notebook, but can't find out how to do that in this current version.
It used to be in one of the drop down menus but is no longer there.
How ...
363
votes
9
answers
478k
views
Show DataFrame as table in iPython Notebook
I am using iPython notebook. When I do this:
df
I get a beautiful table with cells. However, if i do this:
df1
df2
it doesn't print the first beautiful table. If I try this:
print df1
print ...
355
votes
10
answers
667k
views
Pandas: Setting no. of max rows
I have a problem viewing the following DataFrame:
n = 100
foo = DataFrame(index=range(n))
foo['floats'] = np.random.randn(n)
foo
The problem is that it does not print all rows per default in ...
349
votes
14
answers
579k
views
Simple way to measure cell execution time in ipython notebook
I would like to get the time spent on the cell execution in addition to the original output from cell.
To this end, I tried %%timeit -r1 -n1 but it doesn't expose the variable defined within cell.
%%...
348
votes
17
answers
504k
views
In which conda environment is Jupyter executing?
I have jupyter/anaconda/python3.5.
How can I know which conda environment is my jupyter notebook running on?
How can I launch jupyter from a new conda environment?
343
votes
39
answers
436k
views
How can I prevent Google Colab from disconnecting?
Is there a way to programmatically prevent Google Colab from disconnecting on a timeout?
The following describes the conditions causing a notebook to automatically disconnect:
Google Colab notebooks ...
334
votes
16
answers
545k
views
How can I display an image from a file in Jupyter Notebook?
I would like to use an IPython notebook as a way to interactively analyze some genome charts I am making with Biopython's GenomeDiagram module. While there is extensive documentation on how to use ...
334
votes
32
answers
723k
views
After installing with pip, "jupyter: command not found"
After installing with pip install jupyter, terminal still cannot find jupyter notebook.
Ubuntu simply says command not found. Similar with ipython. Did pip not get install properly or something? ...
327
votes
32
answers
792k
views
Change IPython/Jupyter notebook working directory
When I open a Jupyter notebook (formerly IPython) it defaults to C:\Users\USERNAME.
How can I change this so to another location?
326
votes
14
answers
522k
views
Inserting image into IPython notebook markdown
I am starting to depend heavily on the IPython notebook app to develop and document algorithms. It is awesome; but there is something that seems like it should be possible, but I can't figure out how ...
315
votes
6
answers
320k
views
Autoreload of modules in IPython [duplicate]
Is there a way to have IPython automatically reload all changed code? Either before each line is executed in the shell or failing that when it is specifically requested to. I'm doing a lot of ...
284
votes
15
answers
487k
views
How to run an .ipynb Jupyter Notebook from terminal?
I have some code in a .ipynb file and got it to the point where I don't really need the "interactive" feature of IPython Notebook. I would like to just run it straight from a Mac Terminal ...
283
votes
8
answers
302k
views
Remove the kernel on a Jupyter Notebook
How can I remove a kernel from Jupyter Notebook?
I have an R kernel on my Jupyter Notebook. Recently, the kernel always dies right after I open a new notebook.
273
votes
6
answers
408k
views
How to load/edit/run/save text files (.py) into an IPython notebook cell?
I've recently moved over to using IPython notebooks as part of my workflow. However, I've not been successful in finding a way to import .py files into the individual cells of an open IPython ...
267
votes
11
answers
336k
views
Using both Python 2.x and Python 3.x in IPython Notebook
I use IPython notebooks and would like to be able to select to create a 2.x or 3.x python notebook in IPython.
I initially had Anaconda. With Anaconda a global environment variable had to be changed ...
254
votes
6
answers
359k
views
How to embed HTML into IPython output?
Is it possible to embed rendered HTML output into IPython output?
One way is to use
from IPython.core.display import HTML
HTML('<a href="http://example.com">link</a>')
or (IPython ...
248
votes
8
answers
475k
views
How to know which Python is running in Jupyter notebook?
I use Jupyter notebook in a browser for Python programming, I have installed Anaconda (Python 3.5). But I'm quite sure that Jupyter is running my python commands with the native python interpreter and ...
244
votes
13
answers
215k
views
Import local function from a module housed in another directory with relative imports in Jupyter Notebook using Python 3 [duplicate]
I have a directory structure similar to the following
meta_project
project1
__init__.py
lib
module.py
__init__.py
notebook_folder
notebook....
243
votes
13
answers
323k
views
tqdm in Jupyter Notebook prints new progress bars repeatedly
I am using tqdm to print progress in a script I'm running in a Jupyter notebook. I am printing all messages to the console via tqdm.write(). However, this still gives me a skewed output like so:
That ...
243
votes
6
answers
393k
views
ipython notebook clear cell output in code
In a iPython notebook, I have a while loop that listens to a Serial port and print the received data in real time.
What I want to achieve to only show the latest received data (i.e only one line ...
240
votes
13
answers
289k
views
collapse cell in jupyter notebook
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 ...
230
votes
7
answers
745k
views
How to read a .xlsx file using the pandas Library in iPython?
I want to read a .xlsx file using the Pandas Library of python and port the data to a postgreSQL table.
All I could do up until now is:
import pandas as pd
data = pd.ExcelFile("*File Name*")
Now I ...
223
votes
13
answers
384k
views
How to set env variable in Jupyter notebook
I've a problem that Jupyter can't see env variable in bashrc file. Is there a way to load these variables in jupyter or add custom variables to it?
223
votes
12
answers
332k
views
How to show PIL Image in ipython notebook
This is my code
from PIL import Image
pil_im = Image.open('data/empire.jpg')
I would like to do some image manipulation on it, and then show it on screen.
I am having problem with showing PIL Image ...
216
votes
23
answers
454k
views
"ImportError: No module named" when trying to run Python script
I'm trying to run a script that launches, amongst other things, a python script. I get a ImportError: No module named ..., however, if I launch ipython and import the same module in the same way ...
213
votes
10
answers
168k
views
Get Output From the logging Module in IPython Notebook
When I running the following inside IPython Notebook I don't see any output:
import logging
logging.basicConfig(level=logging.DEBUG)
logging.debug("test")
Anyone know how to make it so I can see the ...
211
votes
35
answers
703k
views
How to fix "'jupyter' is not recognized as an internal or external command, operable program or batch file" when running Jupyter on Windows?
I have installed Jupyter on Windows 10, Python 3.x via
$ pip install jupyter
The installation works fine, even though I did restart the terminal.
But trying to run
$ jupyter notebook
gives the ...
211
votes
8
answers
185k
views
How to add conda environment to jupyter lab
I'm using Jupyter Lab and I'm having trouble to add conda environment. The idea is to launch Jupyter Lab from my base environment, and then to be able to choose my other conda envs as kernels.
I ...
208
votes
11
answers
288k
views
How can I add a table of contents to a Jupyter / JupyterLab notebook?
The documentation at http://ipython.org/ipython-doc/stable/interactive/notebook.html says
You can provide a conceptual structure for your computational document as a whole using different levels of ...
203
votes
5
answers
196k
views
How do you suppress output in Jupyter running IPython?
How can output to stdout be suppressed?
A semi-colon can be used to supress display of returned objects, for example
>>> 1+1
2
>>> 1+1; # No output!
However, a function that ...
201
votes
24
answers
235k
views
How to hide code from cells in ipython notebook visualized with nbviewer?
I have an ipython/jupyter notebook that I visualize using NBviewer.
How can I hide all the code from the notebook rendered by NBviewer, so that only the output of code (e.g. plots and tables) and the ...
196
votes
14
answers
473k
views
IOPub data rate exceeded in Jupyter notebook (when viewing image)
I want to view an image in Jupyter notebook. It's a 9.9MB .png file.
from IPython.display import Image
Image(filename='path_to_image/image.png')
I get the below error:
IOPub data rate exceeded.
The ...
189
votes
5
answers
223k
views
How can I see function arguments in IPython Notebook Server 3?
I've recently switched to IPython Notebook 3 (3.1.0-cbccb68 to be exact), the Anaconda version. Previously when I typed a function and opened a parenthesis like this:
time.sleep()
and if the cursor ...
189
votes
10
answers
364k
views
How to change color in markdown cells ipython/jupyter notebook?
I'm only looking to format a specific string within a cell. I change that cell's format to "Markdown" but I'm not sure how to change text color of a single word.
I don't want to change the look of ...
189
votes
10
answers
192k
views
Jupyter/IPython Notebooks: Shortcut for "run all"?
Is there a shortcut to run all cells in an IPython notebook?
And if not, does this have a specific reason?
181
votes
4
answers
205k
views
Calling pylab.savefig without display in ipython
I need to create a figure in a file without displaying it within IPython notebook. I am not clear on the interaction between IPython and matplotlib.pylab in this regard. But, when I call pylab.savefig(...