By Installing Kaggle In our Colab Notebook

Step 1: Select any dataset from Kaggle

Kaggle dataset 

Step 2: Download Dataset API Token

We will download the Kaggle API token which will be present in Account directory under our Kaggle profile section. The file name for the token will be Kaggle.json

Kaggle token file 

To download the dataset  

Step 3: Setup the Colab Notebook

To download the dataset into google colab notebook we first have to install kaggle in our local system then we will grant permission kaggle.json file to download file dataset from third party link 

  • Install the Kaggle library
 pip install kaggle
  • Make a directory named “.kaggle”
 mkdir ~/.kaggle
  • Copy the “kaggle.json” into this new directory
 cp kaggle.json ~/.kaggle/
  • Allocate the required permission for this file.
 chmod 600 ~/.kaggle/kaggle.json

Command to install Kaggle API in Colab notebook 

Step 4: Download the Dataset into Colab File 

To download the dataset into Colab we will use another command followed by the dataset name 

  • For Downloading dataset 

Suppose our dataset web link in 

https://www.kaggle.com/datasets/gauravduttakiit/cassava-leaf-disease-classification

then we will type 

! kaggle datasets download gauravduttakiit/cassava-leaf-disease-classification

Kaggle dataset download command 

  • For downloading competitions data 

Suppose our competition data link is 

https://www.kaggle.com/competitions/playground-series-s3e14

then we will type 

! kaggle competitions download playground-series-s3e14

Kaggle competition download command 

How to Import Kaggle Datasets Directly into Google Colab

In this article, we will see how to import Kaggle Datasets into Google Colab.

Similar Reads

Getting Started

Here, we are going to cover two different methods to start working with Colab. In the first method, we will use Kaggle API to download our dataset, and after that, we are good to go to use our dataset. In another method, we manually download from the Kaggle website and use our dataset for our production or analysis data. you first need to log in to your Google account, then go to this link https://colab.research.google.com....

Method 1: Downloading Kaggle Dataset in Google Colab Notebook

Step 1: Open your Google Colab Notebook...

Method 2: By Installing Kaggle In our Colab Notebook

...

Method 3: By easily downloading the Kaggle dataset.

...