How to Install and Use Google Colab

The best way to save time and resources is to use Google Colab instead of Jupyter Notebooks directly. This is true when you want to work with multiple data science projects, do EDAs and modeling and even to work collaboratively. In Jupyter Notebook you have to create virtual environments and install every Python package from scratch per each project. 

Colab also helps us to have better computing resources, we can buy a subscription to have GPUs and run notebooks and code faster. 

We also will be talking about how to take advantage of the Google Drive ecosystem, saving datasets and files in Drive and importing and exporting data from there. 

Note: if you don’t know what is Colab, please refer to this link:


  1. What is Colab?
  2. Connecting Google Colab with our Drive
  3. Creating our first Notebook
  4. Connecting Google Colab with our CSV file in Drive
  5. Reading CSV data using Pandas
  6. Changing theme to Dark Mode

Step #1 - What is Colab?

Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows anybody to write and execute arbitrary python code through the browser, and is especially well suited to machine learning, data analysis and education. More technically, Colab is a hosted Jupyter notebook service that requires no setup to use, while providing access free of charge to computing resources including GPUs.

Is it really free of charge to use?
Yes. Colab is free of charge to use.

Seems too good to be true. What are the limitations?
Colab resources are not guaranteed and not unlimited, and the usage limits sometimes fluctuate. This is necessary for Colab to be able to provide resources free of charge. For more details, see Resource Limits

Users who are interested in more reliable access to better resources may be interested in Colab Pro.

Resources in Colab are prioritized for interactive use cases. We prohibit actions associated with bulk computation, actions that negatively impact others, as well as actions associated with bypassing our policies. The following are disallowed from Colab runtimes:

file hosting, media serving, or other web service offerings not related to interactive compute with Colab
  • downloading torrents or engaging in peer-to-peer file-sharing
  • using a remote desktop or SSH
  • connecting to remote proxies
  • mining cryptocurrency
  • running denial-of-service attacks
  • password cracking
  • using multiple accounts to work around access or resource usage restrictions
  • creating deepfakes

Additional restrictions exist for paid users.

What is the difference between Jupyter and Colab?
Jupyter is the open source project on which Colab is based. Colab allows you to use and share Jupyter notebooks with others without having to download, install, or run anything.

Step #2- Connecting Google Colab with our Drive

So to your Google Drive and follow the steps. 

After you click on Connect More Apps, type “Colaboratory”

Click on Individual Install

Click Continue

Step #3 - Creating our first Notebook

You are ready. Now let’s create our first Notebook

This will open the next window

Rename the project

Step #4 - Connecting Google Colab with our CSV file in Drive

Now let’s create data samples. Go to the following link and download the CSV. Upload that file into your Google Drive inside the same folder you created the Google Collab file

Now we have to connect the CSV file with Google Colab. To do this follow the next tutorial. It's quite simple and a necessary step to read the data. I followed the simple steps

Once everything is done you should see this folder tree (with your own files)

Copy that path, it will help us to import that data. Copy the following commands into your Google Colab to check everything is working well. 

Step #5 - Reading CSV data using Pandas

import pandas as pd

csv_in_drive = "/content/drive/MyDrive/your_path/salary.csv"

df = pd.read_csv(csv_in_drive)

My result

We can now see the table with the csv data. It works!

Step #6 - Changing theme to Dark Mode

Let’s tune our Google Colab to dark mode!


Much better!

Hope you learned a lot with this post. Se you on the next one!

Daniel Morales Perez


Daniel Morales Perez

Other posts