本文介绍了如何在Google Colab中下载 pandas 数据框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在如何在Google Colab中创建熊猫DataFrame之后将其下载到本地磁盘(或下载到Google Drive)上.我尝试将其转换为字节,字符串(使用pd.to_string),字典(pd.to_dict),但似乎无济于事.

I have been stuck on how to download a pandas DataFrame into my local disk (or onto Google Drive) after creating it in Google Colab. I have tried converting it to bytes, a string (using pd.to_string), a dict (pd.to_dict), but nothing seems to work.

此外,我还研究了如何使用drive.CreateFile方法(如Colab代码简介中所述),并在此处指定:,但是我不确定如何将其应用于熊猫.

Additionally, I've looked at using the drive.CreateFile method as explained in the intro Colab Code and as specified here: How to download file created in Colaboratory workspace?, but I'm not sure how to apply this to pandas.

感谢您的帮助-谢谢!

推荐答案

也许是这样的.

from google.colab import files

df.to_csv('df.csv')
files.download('df.csv')

这篇关于如何在Google Colab中下载 pandas 数据框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 13:29