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

get data from kaggle to colab

import opendatasets as od
import pandas
  
od.download(
    "https://www.kaggle.com/datasets/
    muratkokludataset/acoustic-extinguisher-fire-dataset")
Comment

PREVIOUS NEXT
Code Example
Python :: change the color of the button on hovering tkinter 
Python :: pandas where based another column 
Python :: get n items from dictionary python 
Python :: python loop through list 
Python :: python faker 
Python :: python list subdirectories 
Python :: python pearson correlation 
Python :: align columns to left pandas python 
Python :: openpyxl change sheet name 
Python :: index of sorted list python 
Python :: random word py 
Python :: command to check python version in linux 
Python :: sys get current pythonpath 
Python :: csv write without new line 
Python :: CUDA error: device-side assert triggered 
Python :: distribution plot python 
Python :: python tkinter treeview get selected item 
Python :: sqlalchemy check if database exists 
Python :: scikit learn svm 
Python :: boolean python meaning for idiots 
Python :: quit button tkinter 
Python :: check date on template django 
Python :: how to print all rows in pandas 
Python :: pandas repeat rows n times 
Python :: sample datafra,e PYTHON 
Python :: How to set up flash message in html template in flask app 
Python :: mode of a column in df 
Python :: remove blanks from list python 
Python :: Basic method of Converting List to Dataframe 
Python :: get time in ms python 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =