Copyright : GNU General Public License v2
Author : Adrien Leger / aleg@ebi.ac.uk / Github
Date : 17/11/2016
Source : https://jupyter.org/
In [1]:
from IPython.core.display import display, HTML, Image
display(HTML("<style>.container { width:80% !important; }</style>"))
In [2]:
from traitlets.config.manager import BaseJSONConfigManager
path = "/home/damian/miniconda3/envs/rise_latest/etc/jupyter/nbconfig"
cm = BaseJSONConfigManager(config_dir="/home/aleg/.jupyter/nbconfig/")
cm.update(
'livereveal', {
'theme': 'simple',
'transition': 'zoom',
'transition-speed' :'fast',
'start_slideshow_at': 'selected',
'scroll': True,})
Out[2]:
I therefore concluded and decided unhesitatingly, that there are three stars in the heavens moving about Jupiter, as Venus and Mercury round the Sun; which at length was established as clear as daylight by numerous subsequent observations. These observations also established that there are not only three, but four, erratic sidereal bodies performing their revolutions round Jupiter...the revolutions are so swift that an observer may generally get differences of position every hour.
Galileo trans Carlos, Sidereus Nuncius (1610), 1880, p47.
>>>jupyter notebook
Sans serif red
Bold Italic Underligned
Terminal like
When $a \ne 0$ there are two solutions to $ax^2 + bx + c = 0$
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$This line mixes markdown formatting with HTML formatting and even MathJax mathematics
In [ ]:
for i in range (5):
print (i)
In [ ]:
from random import choice
"".join(choice(["A","T","C","G"]) for i in range(100))
Examples of direct shell commands
In [ ]:
ls ../
In [ ]:
pwd
In [ ]:
man ls
By adding the magic "!" any bash command can be run in Jupyter
In [ ]:
!for l in *.ipynb; do echo $l; done
In [ ]:
!cat "./[0]-Introduction_to_Jupyter_Notebook.ipynb" | grep "cell_type" | head
You can even mix bash and python in the same cell
In [ ]:
# Attribute a bash output to a python variable
a = !ls
# Loop with python over the lines returned previously
for file in a:
# print with bash
!echo {file}
In [ ]:
%%bash
echo -e "Bash kernel!\n"
In [ ]:
%%perl
print "PERL Kernel\n";
In [ ]:
%%python3
print ("Python3 kernel")
In [ ]:
%%R
cat ("R kernel")
In [ ]:
%%javascript
alert("Javascript kernel");
First open a terminal
Go to a working directory (with cd and mkdir)
Launch the notebook server with:
jupyter notebook
A tab will be open in you default web browser
If not, or if you want to use a different browser, open the browser and type the following URL :
http://localhost:8888/
Explore the tabs of the control panel
Navigate in the files/folders in the files tab
You can create new, files, folder or run a terminal
Create a new python3 notebook
Handy shortcuts
A : insert cell above
B : insert cell below
X : cut selected cells
C : copy selected cells
Y : convert cell type to code
M : convert cell type to markdown
R : convert cell type to raw
Now you can play with markdown and code cells...
Presentation powered by Jupyter Notebook with RISE ("Live" Reveal.js Jupyter/IPython Slideshow Extension)