Show Menu
Cheatography

Jupyter Notebook Keyboard Shortcuts by

Shortcuts and Tips for the world's most popular data science and python IDE

Command Mode - Esc to enter

Up/Down Arrow Keys
Navigate Cells
A
Insert Cell Above
B
Insert Cell Below
Shift Tab
Docstring for object. Press again to cycle docstring type
F
Find and Replace
O
Toggle Output
Shift Up/Down Arrows
Select Cells Above/­Below
Shift M
Merge Multiple Cells
Ctrl Shift -
Split cell
y
Change to code
m
Change to markdown
Number 1-6
Change to heading
c
Copy a cell
x
Cut a cell

Whilst holding Entr - Running Cells

Shift
Run Cell and Select Below
Alt
Run Cell and Insert below
Ctrl
Run Cell and stay on same cell

After pressing Esc - Kernel Commands

ii
Interupt
00
Restart
 

Whilst Holding Control

a
Select all
z
Undo
Shift Z
Redo
]
Indent
[
Dedent

Typed Tips

jupyter nbconvert --to script NOTEBO­OK_­NAM­E.ipynb
Convert to other formats (script converts to Python)
from IPytho­n.c­ore.in­ter­act­ive­shell import Intera­cti­veShell Intera­cti­veS­hel­l.a­st_­nod­e_i­nte­rac­tivity = "­all­"
Multiple outputs in the same cell
from IPytho­n.c­ore.di­splay import display, HTML displa­y(H­TML­("<s­tyl­e>.c­on­tainer { width:95% !impor­tant; }</­sty­le>­"))
Change width of current notebook
import sys !{sys.e­xe­cut­able} -m pip install numpy
Import package in current notebook

Cell Magic Commands, %% character prefix

%%time
Place at the top of a cell to check how long the cell takes to execute
%%heat
Place at the top of a cell to check how long each line of code takes to execute
%%bash
Run cells as bash script
 

Line Magic Commands, % prefix

%lsmagic, %quickref
List all available magic commands, describe magic commands
%pastebin x-y
Create a url code from current Jupyter Notebook cell x to y
%whos
Returns the variables present in the global space along with its type. Pass arguments to return variables of a specific type
%automagic
Make magic functions callable without having to type the initial %.
%pdb, %pdb off
Control automatic calling of the pdb intera­ctive debugger.
%pip
Install the python module using the pip package manager in the jupyter notebook
%dhist
History of direct­ories visited in the notebook
%history
The history of commands which were executed in a notebook.
%precision
Sets the precision of floating point numbers
%run ./swar­m.ipynb
Lets us run the python file or a different jupyter notebook file in the jupyter notebook
%env
Set Enviro­nment Variables You can manage enviro­nment variables of your notebook without restarting the jupyter server process
               
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Jupyter Notebook Editor Keyboard Shortcuts

          More Cheat Sheets by datamansam

          Core Cloud Concepts with AWS Cheat Sheet