Uploaded by Lwandile Ranela

Jupyter notebooks cheat sheet

advertisement
Keyboard Shortcuts
Shortcut
Description
Esc
Enter command mode
Enter
Enter edit mode
Shift + Enter
Run cell and select next cell
Ctrl + Enter
Run cell
Alt + Enter
Run cell and insert new cell below
Y
Change cell type to code
M
Change cell type to markdown
A
Insert cell above
B
Insert cell below
D, D
Delete selected cell
Z
Undo cell deletion
Shift + M
Merge selected cells
Ctrl + S
Save notebook
Shift + L
Toggle line numbers
Shift + Tab
Show docstring for object
Ctrl + Shift + -
Split cell at cursor
Ctrl + Shift + P
Open command palette
Cell Operations
Operation
Syntax
Description
Comment
#
Add a comment to a code cell
Output
print()
Display output from a code cell
Clear Output
Ctrl + L
Clear the output of a cell
Interrupt
I, I
Interrupt the execution of a cell
Restart
0, 0
Restart the kernel
Run All
Shift + R, A
Run all cells in the notebook
Run Selected
Shift + R, S
Run selected cells in the notebook
Markdown Formatting
Syntax
Description
#
Heading
**bold**
Bold
_italic_
Italic
---
Horizontal line
* item
Unordered list
1. item
Ordered list
> quote
Blockquote
![alt text](image.png)
Image
[link text](http://url.com)
Link
Magic Commands
Command
Syntax
Description
List
%lsmagic
List all available magic commands
Time
%%time
Time the execution of a cell
Load
%load file.py
Load code from a file into a cell
Save
%save file.py
Save code from a cell to a file
Debug
%debug
Enter interactive debugger
PDB
%pdb
Automatically enter debugger on error
Matplotlib
%matplotlib inline
Display matplotlib plots inline
Command
Syntax
Description
Set Breakpoint
import pdb; pdb.set_trace()
Set a breakpoint in code
Next
n
Execute the current line and move to the next
Step
s
Step into a function call
Return
r
Continue execution until the current function r
Quit
q
Quit the debugger
Debugging
Download