Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

download kaggle dataset in colab

Create api key
and yout colab:

from google.colab import files
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
!kaggle competitions -h
!kaggle competitions download -c DATASET
Comment

kaggle dataset download to google colab

def pull_kaggle_data(username,key):
import json
! mkdir .kaggle
token = {"username":username,"key":username}
with open(".kaggle/kaggle.json", "w") as file:
json.dump(token, file)
! cp .kaggle/kaggle.json ~/.kaggle/kaggle.json


================================================================================
pull_kaggle_data(username,key)
! kaggle competitions download -c malware-classification
Comment

PREVIOUS NEXT
Code Example
Python :: how to add 2 dates in python 
Python :: change column value based on another column pandas 
Python :: how to save array python 
Python :: opencv set window size 
Python :: django all urls 
Python :: how to run a function in interval in python 
Python :: openpyxl write in cell 
Python :: find null value for a particular column in dataframe 
Python :: discordpy 
Python :: add y axis label matplotlib 
Python :: random word python 
Python :: python check version 
Python :: plot bounds python 
Python :: how to open csv file in python 
Python :: discord embed colors python 
Python :: distribution plot with curve python 
Python :: how to delete records in pandas before a certain date 
Python :: not scientific notation python 
Python :: primes pytyhon 
Python :: python check if input is between two values 
Python :: Add a quit button Tkinter 
Python :: python pynput letter key pressed 
Python :: append attribute ofpython 
Python :: how to test wifi speed py 
Python :: exit all threads from within a thread python 
Python :: python code to open windows command prompt 
Python :: argparse list 
Python :: remove spaces from a list python 
Python :: pygame.display.flip vs update 
Python :: how to create a loop in python turtle 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =