python - 在 Google Colaboratory 中保存数据

标签 python google-colaboratory

有没有人想出一种方法来保持文件在 Google 的 newly open sourced Colaboratory 中跨 session 持久保存? ?

使用示例笔记本,我成功地从我的 Google 云端硬盘实例验证和传输 csv 文件,并将它们存储在/tmp、我的 ~ 和 ~/datalab 中。 Pandas 也可以从磁盘上读取它们。但是一旦 session 超时,看起来整个文件系统都被清除了,一个新的 VM 启动了,没有下载的文件。

考虑到 Google 的 Colaboratory Faq,我想这并不奇怪:

Q: Where is my code executed? What happens to my execution state if I close the browser window?

A: Code is executed in a virtual machine dedicated to your account. Virtual machines are recycled when idle for a while, and have a maximum lifetime enforced by the system.

鉴于此,也许这是一项功能(即“使用 Google Cloud Storage,它在 Colaboratory 中运行良好”)?当我第一次使用该工具时,我希望 My File/Colab Notebooks Google Drive 文件夹中的任何 .csv 文件也能加载到虚拟机实例中笔记本正在运行:/

最佳答案

把它放在你的代码之前,所以总是会在运行你的代码之前下载你的文件。

!wget -q http://www.yoursite.com/file.csv

关于python - 在 Google Colaboratory 中保存数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47194063/

相关文章:

python - 线程不同时运行。 (Python)

JavaScript:console.log() 生成数字而不是字符

python - 在 Google Colaboratory 上使用 GPU 的 XGBoost

python - 谷歌colab中spacy的位移

python - 无法将库升级到 Google Colab 上的特定版本(scipy 版本 1.8.0)

python - 将整数分配给字符串

python - 如何在python中从 "16SEP2012"创建日期时间对象

python - 在Python中定义main()

python - GPU 在 Google Colaboratory 上的 Pytorch 性能比 CPU 慢

python - 在 Google Colab 中安装 RDKit