Nikolay Koldunov
koldunovn@gmail.com
In order to be productive you need comfortable environment, and this is what IPython Jupyter notebooks provide. This is your "lab book", where you can run the code, visualize data and write the text.
print('I love Python!!!!')
I love Python!!!!
import matplotlib.pylab as plt
%matplotlib inline
x = [1,2,3,4,5]
plt.plot(x);
start
menuYou can use question mark in order to get help. To execute cell you have to press Shift+Enter
?
Question mark after a function will open pager with documentation. Double question mark will show you source code of the function.
plt.plot?
Press SHIFT+TAB after opening bracket in order to get help for the function (list of arguments, doc string).
range(
The magic function system provides a series of functions which allow you to control the behavior of IPython itself, plus a lot of system-type features.
Let's create some set of numbers using range command:
range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
And find out how long does it take to run it with %timeit magic function:
%timeit range(10)
The slowest run took 6.03 times longer than the fastest. This could mean that an intermediate result is being cached 1000000 loops, best of 3: 316 ns per loop
Print all interactive variables (similar to Matlab function):
%whos
Variable Type Data/Info ------------------------------ plt module <module 'matplotlib.pylab<...>es/matplotlib/pylab.pyc'> x list n=5