Jupyter Notebook Cheat Sheets
Anaconda
Jupyter Notebook
Objects
Find, list, search, reset.
a = 10
b = 20.1
c = "test"
d = [ 1 , 2 , 3 ]
Variable Type Data/Info
-----------------------------
a int 10
b float 20.1
c str test
d list n=3
Once deleted , variables cannot be recovered . Proceed ( y /[ n ] ) ? y
Interactive namespace is empty.
a = 10
b = 20
c = "test"
d = [ 1 , 2 , 3 ]
Logging
Start, state, on, off.
Logging has not been activated.
Activating auto-logging. Current session state plus future input saved.
Filename : ipython_log.py
Mode : rotate
Output logging : False
Raw input log : False
Timestamping : False
State : active
Filename : ipython_log . py
Mode : rotate
Output logging : False
Raw input log : False
Timestamping : False
State : active
Filename : ipython_log . py
Mode : rotate
Output logging : False
Raw input log : False
Timestamping : False
State : temporarily suspended
Filename : ipython_log . py
Mode : rotate
Output logging : False
Raw input log : False
Timestamping : False
State : active
Magic & Help
List, help.
Available line magics :
%alias %alias_magic %autocall %automagic %autosave %bookmark %cat %cd %clear %colors %config %connect_info %cp %debug %dhist %dirs %doctest_mode %ed %edit %env %gui %hist %history %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %popd %pprint %precision %profile %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %set_env %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmode
Available cell magics :
%%! %% HTML %% SVG % %bash % %capture % %debug % %file % %html % %javascript % %js % %latex % %perl % %prun % %pypy % %python % %python2 % %python3 % %ruby % %script % %sh % %svg % %sx % %system % %time % %timeit % %writefile
Automagic is ON , % prefix IS NOT needed for line magics .
Open a window about magic commands.
Open a window about the command (minimum, maximum help).
Function
docstrings, info, source.
def print_number ( nb ):
"""
The docstring. print_number prints Hi!
"""
print ( "Hi!" * nb )
print_number ( 1 )
print_number ( 5 )
Open a window about the docstrings.
Open a window about the function.
Navigation
Bookmark, history.
Current bookmarks :
name -> path
untitled -> / home / user
Add a bookmark.
Current bookmarks :
aaa -> path
name -> path
untitled -> / home / user
Delete a bookmark.
Current bookmarks :
name -> path
untitled -> / home / user
Print the directory navigation history.
Directory history (kept in _dh)
0: /home/user
External
Bash, script.
The following is an example of one bash command.
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Total number of aliases: 12
[('cat', 'cat'),
('cp', 'cp'),
('ldir', 'ls -F -o --color %l | grep /$'),
('lf', 'ls -F -o --color %l | grep ^-'),
('lk', 'ls -F -o --color %l | grep ^l'),
('ll', 'ls -F -o --color'),
('ls', 'ls -F --color'),
('lx', 'ls -F -o --color %l | grep ^-..x'),
('mkdir', 'mkdir'),
('mv', 'mv'),
('rm', 'rm'),
('rmdir', 'rmdir')]
Invoke an external script into IPython.
Invoke an external script into IPython and open a window about the script’s profile.
Load the external script into IPython (load print_text.py
turns into # %load print_text.py
).
# %load print_text.py
def print_text ():
"""
The docstring. print_text prints Hi!
"""
print ( "Hi!" )
print_text ()