Questions tagged [ipython-notebook]

The IPython Notebook consists of two related components: (1) An JSON based Notebook document format for recording and distributing Python code and rich text. (2) A web-based user interface for authoring and running notebook documents.

The IPython Notebook, Deprecated: now a jupyter notebook, consists of two related components:

  1. A JSON based Notebook document format for recording and distributing Python code and rich text
  2. A web-based user interface for authoring and running notebook documents

The Notebook can be used by starting the Notebook server with the command:

$ ipython notebook

On recent systems this will result in a warning: Subcommandipython notebookis deprecated and will be removed in future versions.

The landing page of the notebook server application, which we call the IPython Notebook dashboard, shows the notebooks currently available in the directory in which the application was started, and allows you to create new notebooks.

A notebook is a combination of two things:

  1. An interactive session connected to an IPython kernel, controlled by a web application that can send input to the console and display many types of output (text, graphics, mathematics and more). This is the same kernel used by the Qt console, but in this case the web console sends input in persistent cells that you can edit in-place instead of the vertically scrolling terminal style used by the Qt console.
  2. A document that can save the inputs and outputs of the session as well as additional text that accompanies the code but is not meant for execution. In this way, notebook files serve as a complete computational record of a session including explanatory text and mathematics, code and resulting figures. These documents are internally JSON files and are saved with the .ipynb extension.

If you have ever used the Mathematica or Sage notebooks (the latter is also web-based) you should feel right at home. If you have not, you should be able to learn how to use it in just a few minutes.

[source]

2014 questions
423
votes
12 answers

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! edit: 5/2017 I now use jupyterthemes:…
vgoklani
  • 8,218
  • 11
  • 52
  • 81
339
votes
24 answers

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? Here's a screenshot of what the default Jupyter…
quickbug
  • 4,124
  • 4
  • 14
  • 19
315
votes
11 answers

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 there a way to do it via command line?
Stefan Krawczyk
  • 3,183
  • 3
  • 12
  • 6
282
votes
7 answers

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 df2 It prints out the table in a different format…
Chris
  • 9,530
  • 8
  • 34
  • 58
260
votes
11 answers

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 to select what version of python you want and…
deltap
  • 3,896
  • 7
  • 24
  • 33
233
votes
13 answers

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. %%time works for cell which only contains 1…
colinfang
  • 17,887
  • 11
  • 69
  • 146
178
votes
7 answers

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 ipython notebook, but I have to slice to view the…
Andy
  • 7,399
  • 10
  • 33
  • 37
174
votes
12 answers

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 callable, yet I want to hide / collapse the cell in order…
aloha
  • 3,504
  • 5
  • 26
  • 35
170
votes
20 answers

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 markdown cells are shown?
lucacerone
  • 8,140
  • 12
  • 48
  • 72
157
votes
3 answers

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 showing the most recent data. no scrolling in the cell…
aha
  • 3,474
  • 3
  • 19
  • 27
151
votes
8 answers

ImportError: No module named notebook.notebookapp

What do you recommend guys for this error when I type in console ipython notebook and got ImportError: No module named notebook.notebookapp ? I installed ipython notebook with pip and really I don't know what is going on.
dapias
  • 2,180
  • 2
  • 12
  • 20
137
votes
12 answers

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 in python notebook. I have tried: print…
WebOrCode
  • 5,602
  • 7
  • 35
  • 62
134
votes
2 answers

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("test.png") the current figure get's displayed…
tnt
  • 2,781
  • 3
  • 22
  • 23
133
votes
7 answers

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 know that the step got executed successfully, but…
Sabareesh Kappagantu
  • 1,537
  • 3
  • 12
  • 15
122
votes
10 answers

resize ipython notebook output window

By default the ipython notebook ouput is limited to a small sub window at the bottom. This makes us force to use separate scroll bar that comes with the output window, when the output is big. Any configuration option to make it not limited in size,…
nom-mon-ir
  • 3,258
  • 4
  • 23
  • 40
1
2 3
99 100