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 Julia, Python and R, hence the name JuPyteR 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 either use pip or pipenv to install JuPyter

Pip

pip install jupyter

Pipenv

pipenv 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

You can open command palette via

Cmd + Shift + P on Mac OS or via

Ctrl + Shift + P on Linux and Windows

Ctrl + Enter: Run Cell

Alt + Enter: Run Cell and insert new cell below

https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/

Leave a Reply

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