Cheatography
https://cheatography.com
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
|
|
Whilst Holding Control
a |
Select all |
z |
Undo |
Shift Z |
Redo |
] |
Indent |
[ |
Dedent |
Typed Tips
jupyter nbconvert --to script NOTEBOOK_NAME.ipynb |
Convert to other formats (script converts to Python) |
from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" |
Multiple outputs in the same cell |
from IPython.core.display import display, HTML display(HTML("<style>.container { width:95% !important; }</style>")) |
Change width of current notebook |
import sys !{sys.executable} -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 interactive debugger. |
%pip |
Install the python module using the pip package manager in the jupyter notebook |
%dhist |
History of directories visited in the notebook |
%history |
The history of commands which were executed in a notebook. |
%precision |
Sets the precision of floating point numbers |
%run ./swarm.ipynb |
Lets us run the python file or a different jupyter notebook file in the jupyter notebook |
%env |
Set Environment Variables You can manage environment variables of your notebook without restarting the jupyter server process |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by datamansam