[英]Downloading Kaggle files in Python
我的問題是以下內容的延續: Kaggle API *within* python 的文檔? .
所以,我用 Kaggle API 下載了一個數據集:
api.dataset_download_files('berkeleyearth/climate-change-earth-surface-temperature-data',
path='datasets/kaggle', unzip=True)
有沒有辦法獲取下載的 csv 文件的名稱? 還是我必須確保將文件下載(並解壓縮)到我應該瀏覽的專用文件夾中?
請參閱此處的文檔: https://technowhisp.com/kaggle-api-python-documentation/
5.2 列出數據集文件
api.dataset_list_files('avenn98/world-of-warcraft-demographics').files
pip install kaggle
然后進行身份驗證
Authenticating With API Server
from kaggle.api.kaggle_api_extended import KaggleApi
api = KaggleApi()
api.authenticate()
Downloading Datasets
並下載
# Download all files of a dataset
# Signature: dataset_download_files(dataset, path=None, force=False, quiet=True, unzip=False)
api.dataset_download_files('avenn98/world-of-warcraft-demographics')
# downoad single file
#Signature: dataset_download_file(dataset, file_name, path=None, force=False, quiet=True)
api.dataset_download_file('avenn98/world-of-warcraft-demographics','WoW Demographics.csv')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.