Importing Dataset Into Google Colab from Google Drive

Sahil Gupta
1 min readJul 14, 2021

--

Google Colab is one of the best online platforms to make python notebooks. It provides the best features and hardware support such as GPUs and TPUs. This fastens the work of developing and testing the machine learning models.

However, Google Colab could be very overwhelming at first and one most common issue that most people face is importing the datasets into the Google Colab runtime.

In this article, I’ll show you how you can use your dataset in the Colab notebook.

Uploading dataset from Google Drive

This option will create a “Choose File” button in your notebook, using which you can upload your dataset to the notebook’s runtime. This can be useful for small datasets.

Step 1: Uploading the files

from google.colab import drivedrive.mount('/content/gdrive')import pandas as pd

To go to your drive’s main directory(the one that is visible when you open Google Drive) cd into “/content/gdrive/My Drive/”

test_data = pd.read_csv('/content/gdrive/My Drive/Housing-Price-Prediction/data/test.csv')

--

--

Sahil Gupta
Sahil Gupta

No responses yet