Skip to content

Instantly share code, notes, and snippets.

@mrm8488
Created January 21, 2020 10:35
Show Gist options
  • Select an option

  • Save mrm8488/37670562bf12dd67df9e725ead5c696b to your computer and use it in GitHub Desktop.

Select an option

Save mrm8488/37670562bf12dd67df9e725ead5c696b to your computer and use it in GitHub Desktop.
How to import/download a Kaggle dataset into a Google Colab Notebook
# Easy Steps to persist Kaggle profile by @mrm8488 (Manuel Romero)
# Download kaggle.json from Kaggle -- MyAccount -> Create New API Token -> auto downloads as "kaggle.json
# Import json into notebook - run in a cell
from google.colab import files
files.upload()
# Browse to downloaded kaggle.json and upload
# Setup Kaggle DIR; copy json file ; chmod
!mkdir -p ~/.kaggle
!cp kaggle.json ~/.kaggle/
!chmod 600 ~/.kaggle/kaggle.json
!ls ~/.kaggle
# Verify json content
!ls -l ~/.kaggle
!cat ~/.kaggle/kaggle.json
# Install kaggle packages
!pip install -q kaggle
!pip install -q kaggle-cli
# List Kaggle DataSets
!kaggle datasets list
# List Kaggle Competitions
!kaggle competitions list
# Download a dataset
!kaggle datasets download -d ntnu-testimon/paysim1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment