Learning by Teaching: Working with Colab, Spyder, Jupyter and Github

Patcha Pangatungan
5 min readSep 18, 2020

I was wondering before why we were asked to write a Medium blog on the code along of our assignments.

After writing my first medium blog yesterday on Command Line and Spyder, I realized that through writing a blog of how I did the coding step-by-step, I learned and understood more on what I did and what I was writing about. I realized that this is actually a good practice (especially if you have time) — to write about how you did something and explain the step-by-step process instead of just doing it and coding along with some videos which you may forget on the next couple of days. I realized that I wrote my first blog in a way that I thought it was the way on how I would do when I teach it to other people. But eventually, I think I wasn’t actually writing for anyone. Instead, I was writing for myself. Writing these kind of blogs helps in retaining all the concepts, knowledge and experience I gained in learning the basics and moving forward in the field.

So for now, let’s deal with coding in Python and the different tools and environment that would aid in our Data Science journey.

COLAB

Colaboratory or more well known as Google Colab is a public, free, Jupyter-like notebook environment that has several machine learning libraries for data science and machine learning use. Just like Google Docs, you can also share and simultaneously edit documents stored in the cloud by using Colab.

Accessing Colab. You can access a Colab notebook by accessing this link: https://colab.research.google.com. Click the new notebook button to start with a blank untitled Colab notebook. You can rename the default title of Untitled1.ipynb found at the upper left side to a suitable title that describes your colab notebook.

To start your code, you can add code or text cells by hovering your mouse on the upper part or lower part of a block or by clicking the + Code or + Text button found on the toolbar.

Text cells in colab use a simple markup language called markdown. Letters, words or phrases can be typed and formatted following the markup language syntax on the left panel of the text cell while the output of the markdown code is displayed on the right panel of the text cell. Here are some examples:

You may also move the cell up and down, link the cell, add a comment, edit, delete and do different actions using the buttons found on the upper right hand of each cell.

You can write Python commands and execute these commands using the code cells in Colab by hitting Shift+Enter. A number enclosed on brackets [] will be generated upon entering and executing the code. You may also run the code by clicking the play button on the specific code cell.

Let’s try to run some codes from our previous exercise on using pandas and creating dataframes.

You may also write the dataframes into new csv files and download it into your computer

You can also mount your Google Drive to link and use some files into your Colab notebook.

Calling a python file in Google Drive will run and execute the code and show the result afterwards.

Lastly, running the following code will enable you to export your file into Google sheets:

You may directly save the copy of your Colab notebook by clicking File > Save a Copy in Github and choosing the repository

JUPYTER

You may access Jupyter by typing Anaconda on your Windows search bar and launching the Jupyter notebook on the Anaconda Navigator window

Choose a folder to work on, for this exercise, the cloned repo of the FTW4-Github-Homework-1

Click the folder, click new and choose Python 3 notebook

Jupyter notebook resembles the Colab notebook in a lot of things including the code and text cells. Use the toolbar to generate code and markdown cells, move these cells, run it and do some actions on these cells.

Type and execute the similar codes you used during the Colab exercise and compare results.

Getting used to the Jupyter Notebook is easy especially if you already tried the Google Colab notebook.

SPYDER

As we’ve tackled the basics of Spyder in my previous blog, we just need to run the previous codes we used in Colab and Jupyter.

Upon running the codes, we cancheck the dataframe by clicking df on the variable explorer.

Additionally, a grab_on_spyder.csv on the working file directory is also created using this script

GITHUB

Lastly, let’s commit all the .ipynb / .py / csv files to a new Github repo named
HW-on-Jupyter-Spyder-and-Colab
. To do this, follow along these command line codes:

Committing Spyder execises:

Committing Jupyter exercises:

It was a whole lot of coding and getting back to the basics and hopefully, we’ll learn more throughout this journey. #koko

--

--