Wondered what those
Out things are in your Jupyter notebooks and how to make use of them?
See the notebook source on Github
Jupyter notebooks are a powerful browser based interactive computing notebook that makes it super easy to make high quality presentations of data. Jupyter has got popular in recent years because it lends itself very well to data science tasks as it makes it easy to work with data and create nice visualizations and reports from within the browser.
The nature of the interactivity is such that the input and outputs are not based on the traditional file based structure but on cells that get executed in a certain order.
Here's a fairly simple example of a Jupyter notebook:
Breaking this down a but we see on the first line marked with
In that we have defined some items in a list.
On the second line we output a single item, and because it's the last item executed it gets placed into the output for that cell which is
Out (note that this is just the default behavior, you can change this if you want).
You can interact directly with the
Out from within cells themselves like so:
Out are just a simple
list and a
In is a list of strings that form the contents of the cells.
Out is a dictionary of pairs of line numbers with strings that contained the output. The reason
Out is not a list is because some lines don't contain an output, like line 1 in this example.
More information about the Input and Output caching can be found on the IPython official documentation here