簡體   English   中英

如何從網站將zip直接讀取到jupyter筆記本中

[英]How to read a zip from from a website directly into a jupyter notebook

這是我從中收集數據的網站鏈接:

https://www.kaggle.com/c/talkingdata-adtracking-fraud-detection/data

本質上,由於我的本地系統無法處理大小,因此我想收集火車數據集並將其直接讀取到我的數據科學經驗筆記本中。 我可以使用!wget下載zip文件,但是當我嘗試使用unzip它只會顯示以下消息:

Archive:  train.csv.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of train.csv.zip or
        train.csv.zip.zip, and cannot find train.csv.zip.ZIP, period.

這是我目錄中的內容:

a_hv9j8u_anything.log  model.h5.base64  watsoniotp.broken.pickle
data               rklib.py     watsoniotp.healthy.pickle
MNIST_data         rklib.pyc
model.h5           train.csv.zip

任何幫助將非常感激。

我想你在做

!wget https://www.kaggle.com/c/8540/download/test_supplement.csv.zip

下載文件后,您會看到文件大小僅為8KB。

!ls -l test_supplement.csv.zip

下載的文件確實不是有效的zip文件,而是顯示給您的HTML文件,用於登錄到Kaggle。 !cat test_supplement.csv.zip將HTML內容。

身份驗證后,可以下載Kaggle數據集,因此wget或curl在沒有身份驗證的情況下將無法工作。

您可以選擇在身份驗證后從網頁上下載數據集,然后將其上傳到您嘗試使用的任何系統中(請注意kaggle在分發前請注意使用此數據集的政策)。

要么

嘗試使用https://github.com/Kaggle/kaggle-api

這是我顯示的筆記本 ,如何安裝和使用上面鏈接中提到的api。

謝謝,查爾斯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM