“plt.plot(a, b, ‘b^’)\n”,
“plt.grid(True)”
],
“language”: “python”,
“metadata”: {},
“outputs”: [
{
“metadata”: {},
“output_type”: “display_data”,
“png”: “iVBORw0KGgoAAAAN...SuQmCC\n”,
“text”: [
“<matplotlib.figure.Figure at 0x105812a10>”
]
}
],
“prompt_number”: 3
}
],
“metadata”: {}
}
]
}
For example, when converting such a file to LaTeX, raw text cells can contain LaTeX code
since the content of such cells is simply passed on by the converter. All this is one of the
reasons why the IPython Notebook is nowadays often used for the composition of larger,
more complex documents, like scientific research papers. You have executable code and
documenting text in a single file that can be translated into a number of different output
formats.
In a finance context this also makes IPython a valuable tool, since, for example, the
mathematical description of an algorithm and the executable Python version can live in
the same document. Depending on the usage scenario, a web page (e.g., intranet), a PDF
document (e.g., client mailings), or a presentation (e.g., board meeting) can be generated.
With regard to the presentation option, you can, for example, skip those cells that may
contain text passages that might be too long for a presentation.
The basic usage of the Notebook is quite intuitive. You mainly navigate it with the arrow
keys and “execute” cells by using either Shift-Return or Ctrl-Return. The difference is that
the first option moves you automatically to the next cell after execution while the second
option lets you remain at the same cell. The effect of “executing” cells depends on the
type of the cell. If it is a code cell, then the code is executed and the output (if any) is
shown. If it is a Markdown cell, the content is rendered to show the result.
Markdown and LaTeX
The following shows a few selected examples for Markdown commands:
**bold** prints the text in bold
*italic* prints the text in italic
_italic_ also prints it in italic
**_italic_** bold and italic
bullet point lists:
* first_bullet
* second_bullet
– renders to a dash
<br> inserts a line break