3 Simple Steps to Import Kaggle Dataset Directly Into Google Colab

Josiah Adesola
4 min readOct 14, 2022

--

Image from endtoend.ai

Introduction

It can be tough to get your Kaggle dataset into Google Colab. Before I found this simple method, I had to download the data from Kaggle, upload it to my Google Drive, and connect to Google Colab.

Do you want to know the easiest way to get your Kaggle dataset into Google Colab? No more downloading and uploading to your Google Drive, just a simple method to connect Kaggle to Google Colab. Keep reading to find out how!

giphy.com

It’s a strenuous process; you don’t want to imagine it.

Let’s talk about Kaggle and Google Colab for newbies and beginners in Data Science…

Kaggle

Kaggle is a fantastic platform for anyone interested in machine learning, data science, data analysis, and data engineering. It is a thriving community of ML enthusiasts and professionals, and one of the largest online communities for data professionals. With Kaggle, you can access a wealth of courses, datasets, and ML notebooks to help you start your journey in the field.

kaggle.com/datasets

There are also numerous machine learning competitions available, with the chance to earn cash prizes by participating. Kaggle is a great resource for anyone looking to get started or advance in the world of machine learning and data science.

kaggle.com/competitions

Google Colab

`Google Colab` is an online platform that enables machine learning engineers and data scientists to collaborate on projects. It provides a convenient way to share notebooks, view and edit them, and is offered by Google’s Research team.

my google colab

Let’s get right back to the real deal!!!

Import Datasets Directly from Kaggle to Google Colab

  1. Install Opendataset Library: To install the opendataset library, you can use the pip package manager by running the following command: pip install opendataset. This will download and install the opendataset library, which you can then use to easily download datasets from Kaggle.

2. Create a Kaggle API token: Download your Kaggle API token. The Kaggle API token is a simple file containing your username and key. You will be required by the open dataset to download a dataset.

  • Log into your Kaggle account.
  • Click on your profile image
  • Click on the account menu, and scroll downwards.
  • Click on the “Create New API Token”, it downloads a JSON file
  • Open the “kaggle.json” file with your Notepad app. Do not share your key with anyone, it’s private.

3. Connect to Dataset — Copy and paste the link of your dataset in place of “https://www.kaggle.com/datasets/gaurav2022/mobile-health”.

After, running this code, this part pops up. The next step is to fill in your username and key from the JSON file. It starts downloading almost immediately.

The file is downloaded directly to your Google Colab.

Yayy! You made it to the end

gif from tenor.com

Kindly share, comment and give a clap if you find this content valuable.

--

--

Josiah Adesola
Josiah Adesola

Written by Josiah Adesola

Writes about machine learning, Data Science, Python. Creative. Thinker. Engineering. Twitter: @_JosiahAdesola

No responses yet