Chapter 2: Getting started with Jupyter and Colab#

Let’s Take a trip to … Jupyter#

Data Science is a process that involves a fair amount of coding. To be able to go back and forth between lines of codes and run them independantly, include equations, images, data scientists have came up with the concept of NOTEBOOKS.

The most popular notebook technologies today are Jupyter (supporting over 40 languages including R and Python. Simply put, imagine notebooks as an environment where you can write, edit your lines of codes, include images, videos to allow an easy readability for any potential reader aside you.

What is Jupyter Notebook?#

Jupyter is a tool that allows data scientists to record their complete analysis process, much in the same way other scientists use a lab notebook to record tests, progress, results, and conclusions.

Originally developed as part of the IPython project, the Jupyter product was used to provide interactive online access to Python.

Over time it became useful to interact with other data analysis tools, such as R, in the same manner. With this split from Python, the tool grew into its current manifestation of Jupyter. IPython is still an active tool that’s available for use. The name Jupyter itself is derived from the combination of Julia, Python, and R.

Multiple usages#

It is an open source web application that gives you the power to create and share documents that contain live codes, equations, vizualisations and narrative text. As a few things that you could do with Jupyter, there are:

  1. data cleaning, transformation, numerical simulation

  2. Statistical modeling, data visualisation and Machine Learning

  3. Running un Julia , Python and R scripts!

  4. Making your code followable by your audience trough interactiveness

  5. Saving your code in various formats (pdf, .tex, .ipynb, .html, … )

You could also use it with your latex syntax. For instance, see the Lorenz System below:

\[\begin{split} \begin{eqnarray} \frac{\mathrm{d}x}{\mathrm{d}t} &=& \sigma (y - x),\\ \frac{\mathrm{d}y}{\mathrm{d}t} &=& x (\rho - z) - y \\ \frac{\mathrm{d}z}{\mathrm{d}t} &=& x y - \beta z \end{eqnarray} \end{split}\]

where we set \(\rho = 10 , \quad \sigma = 28 \quad \textrm{and} \quad \beta = 2.667\).

  1. The edit mode lets you change the content of a cell

  2. The command mode lets you modify a cell as a whole

Let’s explore it!!!!#

  1. Creating, adding cells above or below

  2. Enable the shortcuts dashboard

  3. Changing the mode (Heading, Markdown, code, …)

  4. Renaming, deleting, copying, cutting, pasting cells.

You can easily import graphs and also build your own graphs as wellas well.

#See my code here

cities  = ['Kumasi' , 'Cairo' , 'Karthoum' , 'Surulere']

for city  in cities:
    print ('Welcome to ', city)
Welcome to  Kumasi
Welcome to  Cairo
Welcome to  Karthoum
Welcome to  Surulere

#try and change the cities and print the same

Task : #

  1. try and change the cities and print the same

Ready to Colab?#

Google Colab is a Jupyter Notebook stored in Google Drive.

It is a free cloud service and now it supports free GPU! You can:

  • Improve your Python programming language coding skills.

  • Develop deep learning applications using popular libraries such as Keras, TensorFlow, PyTorch.

Let’s try it!!!#

Task: #

  1. Set your Google Colab account (Simply click on this link)

  2. Click on New Notebook and Bingo!!! your Google Colab account is activated.

  3. From your Gmail, navigate to your Google Driver folder. Could you see a folder with a yellow icon?

  4. Create a Github Account via this link. It is useful if you want to share your codes with the whole world.