Skip to content

Latest commit

 

History

History
98 lines (77 loc) · 1.48 KB

jupyter_notebook.md

File metadata and controls

98 lines (77 loc) · 1.48 KB

Open Jupyter Notebook

jupyter-notebook

Open python

python

Ipython commands

  • Open ipython
ipython
  • Show complete box
a<Tab>
  • Shows info about variable, docstrings if it is function/class
a?
  • Shows source code
a??
  • Normal git command inside Ipython. Most of the Unix commands can be used this way
!git
!ls -la
  • Using debug
debug #just after exceptation
run -d foo.py #invoke debugger before excuting any code
  • Profiling blocks of code
prun -l -s foo()
  • Import code
import foo_lib
  • Load code
load foo_lib.py
  • Run a script. No need to import, just run
run foo.py
  • Restart code
reload(foo_lib)
  • Display all the content of the external file as its output
%pycat foo.py
  • List commands
lsmagic
  • Shows how much time a code needs to run
%time a = some_function()  #Return the running time on this line

%timeit a = some_function() #Return more details, such number of loops

%%time	#Return the running time about all the code below
a = some_funtion()
b = some_another_function()
  • Shows the list of variables in your environment
%who_ls 		#Outputs a list of all interactive variables in your environment

%who_ls function	#Reduces the output to interactive variables of type "function"