BASIC PYTHON FOR RESEARCHERS

by Megat Harun Al Rashid bin Megat Ahmad
last updated: April 14, 2016


Introduction to Jupyter Notebook</span>

(official website: http://jupyter.org/)

The _**Jupyter Notebook**_ free software is an interactive programming tool that utilizes the browser technology as interface. It allows the creation and sharing of documents that contain live computational codes, data processing and visualizations together with explanatory texts. It can be used for scientific and engineering computation as well as business and economy. _**Jupyter Notebook**_ is initially developed as interactive Python interpreter, previously known as _**IPython Notebook**_, but now it supports over 40 programming languages, including _**Julia**_, which was developed specifically for scientific computation. The _**Jupyter Notebook**_ itself is implemented in Python.

This BASIC PYTHON FOR RESEARCHERS tutorial will cover only the _**Jupyter Notebook**_ implementation of Python programming languages and the applications of its libraries particularly for scientific calculations and data processing.

Installation

The _**Jupyter Notebook**_ can be installed in several ways but to follow this tutorial it is recommended that the user install _**Anaconda**_ package (download website: https://www.continuum.io/downloads). This _**Anaconda**_ free package can conveniently installs _**Jupyter Notebook**_, Python and other commonly used libraries for scientific calculations and data processing.

In a Windows operating system, the _**Anaconda**_ package comes with a graphical installer each for different Python version. The tutorial however is written using the Python 2.7 implementation, so it is preferable to download and install this version.

After the _**Anaconda**_ is succesfully installed, it is advisable to update _**Jupyter Notebook**_. This can be done by running the following command in the Command Prompt (Windows):

>conda update jupyter

The _**Anaconda**_ command prompt application can also be used to update _**Anaconda**_ to the latest version.

Additional tools not available in the package can be installed by running the following command in the command prompt, e.g. mathjax tool:

>conda install mathjax

Running Jupyter Notebook

Run this command in the command prompt to start the _**Jupyter Notebook**_:

>jupyter notebook

This shall open the _**Jupyter Notebook**_ in the user default web browser (e.g. Google Chrome, Mozilla Firefox etc.). For a start, the user may want to know the Python and IPython versions that have been installed. These information can be obtained simply by typing (inside the In[ ] input cell) and executed the typed command by pressing Shift+Enter or clicking the run cell (►) button:


In [1]:
!python --version


Python 2.7.11 :: Anaconda 2.2.0 (64-bit)

In [2]:
!ipython --version


4.0.0

The cell when executed will produce the output below it and automatically produce empty input cell below the output. New input cell can manually be created by clicking the (+) button. The user can now start following the tutorial.