Skip to content

Instantly share code, notes, and snippets.

@shivanandmn
Last active February 25, 2021 23:43
Show Gist options
  • Save shivanandmn/7acf0ccfda24f405a76d1f8a6b94ce6d to your computer and use it in GitHub Desktop.
Save shivanandmn/7acf0ccfda24f405a76d1f8a6b94ce6d to your computer and use it in GitHub Desktop.
Download the Kaggle Dataset via API in Google Colab Directly.
#install upgraded to get full-dataset, otherwise you may get sample of it.
!pip install -q kaggle==1.5.6
#upload kaggle.json file
from google.colab import files
files.upload()
#must create ~/.kaggle directory and copy kaggle.json to it.
!mkdir ~/.kaggle
!cp kaggle.json ~/.kaggle
# get the access permission to folder-files
!chmod 600 ~/.kaggle/kaggle.json
#competition dataset download
!kaggle competitions download -c riiid-test-answer-prediction
#unzip to directory and remove zip file
!mkdir dataset
!unzip -q /content/riiid-test-answer-prediction.zip -d /content/dataset
!rm /content/riiid-test-answer-prediction.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment