Colab使用外部数据的7种方法!
那么如何在Colab中使用外部数据集,来完成竞赛呢,本文将给出几种常见的方法。
方法1:通过Files explorer上传
点击Notebook的Files explorer面板:



方法2:使用Colab files上传
from google.colab import filesuploaded = files.upload()

然后就可以选择对应的文件,完成上传:

方法3:读取Github链接

方法4:克隆Github项目
先从命令行下载项目:
!git clone https://github.com/BindiChen/machine-learning.git
然后从对应的路径完成数据读取。

方法5:使用wget/axel下载文件
在Notebook中可以使用Linux系统命令,可以使用wget或axel下载数据:

方法6:读取谷歌硬盘数据
挂载了谷歌硬盘后,写好路径完成读取:


方法7:Kaggle API完成数据下载
首先在Kaggle账户的Kaggle API,点击Create New API Token,会下载一个kaggle.json文件。

!kaggle competitions download -c titanic!kaggle datasets download -d alexanderbader/forbes-billionaires-2021-30


赞 (0)