
1. Searching for the dataset:
Using CLI arguments you can search for any keyword to find the corresponding datasets. CLI statement to get the list of datasets using search statement:
kaggle datasets list -s [KEYWORD]
2. Download the dataset:
After you have searched for the appropriate dataset using CLI arguments for searching, this API provides an advantage to download any datasets from Kaggle to your local machine. Commands to download the files associated with the datasets using CLI:
kaggle datasets download -d [DATASET]
3. Creating and maintaining dataset:
Kaggle API can be used to upload new datasets and versions of datasets using CLI arguments. This can ease the sharing of datasets and projects on Kaggle.
To create a new dataset follow the below steps:
- Assemble the dataset files in a folder to upload on Kaggle.
- To generate metadata, run:
kaggle datasets init -p /path/to/dataset
- Add the metadata to the generated file:
datapackage.json
- To finally create the dataset run:
kaggle datasets create -p /path/to/dataset
To upload a new version of the existing dataset follows the below steps:
- To generate metadata, run:
kaggle datasets init -p /path/to/dataset
- Make sure the
id
field in the metadata filedatapackage.json
points to your dataset. - To finally create the dataset run:
kaggle datasets version -p /path/to/dataset -m "MESSAGE"
4. Searching for the published notebook:
Using Kaggle API you can search using a keyword to find corresponding published notebooks. It enables to search for published Notebooks and their metadata as well as workflows for creating and running Notebooks.
CLI statement to get the list of published notebooks using search keyword:
kaggle kernels list -s [KEYWORD]
5. Download a published notebook:
Kaggle API provides the advantage to download any published notebooks from Kaggle to your local machine. Commands to download the files associated with the notebooks using CLI:
kaggle kernels pull -k [KERNEL] -p /path/to/download -m
6. Creating and Running a notebook:
Kaggle API can be used to upload new notebooks and maintain versions of notebooks using CLI arguments. This can ease sharing notebooks and projects on Kaggle.
To create new notebooks follow the below steps:
- Assemble the code files (notebooks) in a folder to upload on Kaggle.
- To generate metadata, run:
kaggle kernels init -p /path/to/kernel
- Add the metadata to the generated file:
kernel-metadata.json
- To finally create the dataset run:
kaggle kernels push -p /path/to/kernel
To upload a new version of the existing dataset follows the below steps:
- Download the last version of your notebook and corresponding metadata to your local machine:
kaggle kernels pull -k [KERNEL] -p /path/to/download -m
- Make sure the
id
field in the metadata filekernel-metadata.json
points to your notebook. - To finally push the new version of the notebook run:
kaggle kernels version -p /path/to/kernel
7. Interacting with competitions:
Kaggle API tools provide an easy way to interact with the competitions hosted on Kaggle. To accept the rules for any competition, you need to login to the competition site and accept the rules to download the dataset and make the submission. You need to visit the Kaggle website and accept the rules there, as it is not possible through the API.
Commands to interact with the competition hosted on Kaggle:
- List of all ongoing competitions:
kaggle competitions list
- Download the files associated with a competition:
kaggle competitions download -c [COMPETITION]
8. Submitting to a competition:
Submitting to any competition is only possible after you have accepted the submission rules by visiting the Kaggle competition website page.
- CLI arguments to submit to competition and get yourself scored:
kaggle competitions submit -c [COMPETITION NAME] -f [FILE PATH]
- To list all the previous submission to a competition run:
kaggle competitions submissions -c [COMPETITION NAME]