在Google Colab中创建后,我一直坚持如何将pandas DataFrame下载到我的本地磁盘(或Google Drive) . 我已经尝试将其转换为字节,字符串(使用pd.to_string),dict(pd.to_dict),但似乎没有任何效果 .
另外,我已经看过使用drive.CreateFile方法,如介绍Colab代码中所述,并在此处指定:How to download file created in Colaboratory workspace?,但我不知道如何将其应用于pandas .
任何帮助表示赞赏 - 谢谢!
2 回答
也许是这样的 .
对于谷歌colab,我建议使用Pydrive . 你的答案可以在这里找到How to download file created in Colaboratory workspace?
编辑:只需将filename.csv更改为filename.zip或filename.blabla
为什么?因为这条线
内容文件的自动设置格式,因此您无需将其转换为String或Byte .