How to import Kaggle Dataset in Google Colaboratory

Kaggle API Setup

! pip install kaggle
from google.colab import files
Upload kaggle.json file
! mkdir -p ~/.kaggle
! cp kaggle.json ~/.kaggle/
! chmod 600 ~/.kaggle/kaggle.json
import os
os.environ['KAGGLE_USERNAME'] = xxxxxxxxx
os.environ['KAGGLE_KEY'] = xxxxxxxxxxxxxx
! kaggle --version
! pip install --upgrade --force-reinstall --no-deps kaggle

Search Dataset

! kaggle datasets list
Available dataset list
kaggle competitions {list, files, download, submit, submissions, leaderboard}
kaggle datasets {list, files, download, create, version, init}
kaggle kernels {list, init, push, pull, output, status}
kaggle config {view, set, unset}
! kaggle competitions list -s health
! kaggle competitions list — category gettingStarted

Competition Dataset

! kaggle competitions download favorita-grocery-sales-forecasting
! kaggle competitions download favorita-grocery-sales-forecasting -f test.csv.7z



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store