Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

colab kaggle dataset

from google.colab import files
import os
#if you've already uploaded kaggle.json before, don't do it again
if not(os.path.exists("kaggle.json")):
  files.upload() #upload kaggle.json
!pip install --upgrade --force-reinstall --no-deps kaggle
!mkdir -p ~/.kaggle
!cp kaggle.json ~/.kaggle/
!ls ~/.kaggle
!chmod 600 /root/.kaggle/kaggle.json

#COMPETITION DATASET
dataset_name="name of competition" #you can find this on the competition data page
!kaggle competitions download -c {dataset_name}
!mkdir {dataset_name}
!unzip -q {dataset_name}.zip -d {dataset_name}
!rm -f {dataset_name}.zip

#Public Dataset
dataset_url="NAME OF DATASET"
dataset_name=dataset_url.split("/")[1]
!kaggle datasets download -d  {dataset_url}
!mkdir {dataset_name}
!unzip -q {dataset_name}.zip -d {dataset_name}
!rm -f {dataset_name}.zip
 
PREVIOUS NEXT
Tagged: #colab #kaggle #dataset
ADD COMMENT
Topic
Name
3+6 =