Introduction to JuPyter Notebook

JuPyter

Do You know the feeling of being already late to a party when encountering something new?

But when you actually start telling others about it, You realize that it is not too common sense at all, e.g. JuPyter Notebooks.

What is a JuPyter notebook?

In my own words: a browser-based document-oriented command line style exploration tool for python.  Huh!

Ok, let’s break it down:

Browser-based

JuPyter is a client-server concept where you edit your code in a web form in a browser. You send the input of a cell to the server backend for execution and the server sends back a response which will be rendered in your browser.

Document-oriented

On great aspect of a JuPyter is that You can enrich your code in a nice fashion with headlines and markdown code so that you have a document containing code, the result of the code execution and documentation.

http://jupyter.org/

Installation and Run

If You already have a python installation You can use pip to install JuPyter

python -m pip install jupyter

After installation you can start it on the console with:

jupyter notebook

An alternative way is to use the anaconda distribution.

Disadvantages

On big drawback -when your background is SW development- is that You don’t have code completion.

Another disadvantage: modularization of your code is not easy.

Versioning is an issue as well. Because the Jupyter notebook’s json files contains code and generated artifacts like plots every re-run of a notebook changes the file. The diff is not easily comprehensible.

PyCharm Integration

For the code completion issue there is JetBrains for the rescue: PyCharm IDE has an integrated JuPyter editor which supports code completion.

Useful Keyboard Shortcuts

Ctrl + Enter: Run Cell

Alt + Enter: Run Cell and insert new cell below

 

Leave a Reply

Your email address will not be published. Required fields are marked *