Slide 25
Slide 25 text
6.b Kaggle Datasetsへのアップロード
import json
from kaggle.api.kaggle_api_extended import KaggleApi
ID = ‘<自分のkaggleのID>’
DATASET_ID = ‘’
UPLOAD_DIR = ‘’
def dataset_create_new():
dataset_metadata = {}
dataset_metadata['id'] = f'{ID}/{DATASET_ID}'
dataset_metadata['licenses'] = [{'name': 'CC0-1.0'}]
dataset_metadata['title'] = DATASET_ID
with open(OUTPUT_DIR / 'dataset-metadata.json', 'w') as f:
json.dump(dataset_metadata, f, indent=4)
api = KaggleApi()
api.authenticate()
api.dataset_create_new(folder=UPLOAD_DIR, convert_to_csv=False, dir_mode='tar')
● Kaggleデータセットを新規作成する場合
25