4.3 Google Colab

4.3.1 Introduction

Google Colab is a product from Google Research. It allows anybody to write and execute python code through the browser, and to save notebooks on the cloud. So, you can think of Colab as a Jupyter notebook stored in Google Drive. It requires no set up and has an excellent free version.

Here is the official website: https://colab.research.google.com/

MBAn students will use Google Colab frequently in MBAn550 Intro To Data Programming in the summer term, and are likely to use it in the fall term in order to work on Python projects. And we also recommend anyone who is new to Python programming to use Google Colab.

4.3.2 Main Features

Enter and Execute Code in Cells

A cell is a place where you enter either your code or text to be executed. You can easily add, edit and run cells in a Colab notebook. You can also move a cell by selecting it and clicking Cell Up or Cell Down in the top toolbar.

Files Saved on the Google Drive or GitHub

All of your Google Colab notebooks are saved under your Google Drive account, just like your Google Docs and Google Sheets files. Therefore, you can access your notebooks from any device with your Google account log-in. You can also save it to your GitHub repository. Both options enable you to share your projects easily with other developers.

Import Libraries Without Installation

Colab is shipped with several pre-installed data libraries, such as Numpy, Pandas, Matplotlib. It also provides pre-installed machine learning libraries, including TensorFlow, and PyTorch.

Thus, Google Colab is especially well-suited for machine learning and data analysis.

Automatic Completions

Colab provides automatic completions to explore attributes of Python objects. It’s very useful when you are not sure about the functions. As an example, first run the following cell to import the pandas module. Then, as we enter “pd.read”, we can see many automatic completions below, and we can use “Tab” to choose the function we want.

More Options for Your Project Management

You can also add a “section header cell” to make your projects easier to read. You can use a “Table of contents” to make your projects more contextualized. Furthermore, you can comment on your code by selecting a cell and clicking the comment button in the toolbar above the top-right corner of the cell. (Reym 2020)

4.3.3 More Resources

For more advanced tutorials about Colab, you can refer to Colab Tutorials

References

Reym, M. V. D. 2020. 7 Advantages of Using Google Colab for Python. https://python.plainenglish.io/7-advantages-of-using-google-colab-for-python-82ac5166fd4b .