By Installing Kaggle In our Colab Notebook
Step 1: Select any dataset from Kaggle
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
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
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
- 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
How to Import Kaggle Datasets Directly into Google Colab
In this article, we will see how to import Kaggle Datasets into Google Colab.