dataframe - Google Colaboratory 导出数据框

标签 dataframe google-colaboratory

我正在使用 google colaboratory 运行一些模型。我能够在谷歌驱动器中上传具有功能的 csv 文件,将其导入并在该数据上运行模型。我想将最终的数据帧导出到 csv。找不到办法,请指教。

df.to_csv('df.csv', index=False)

这运行没有错误,但我找不到文件的保存位置。

或者让我知道是否有更好的方法可以将我的 df 导出。

最佳答案

您可以使用以下命令将数据下载回本地计算机

from google.colab import files
files.download('df.csv')

关于dataframe - Google Colaboratory 导出数据框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49145519/

相关文章:

python - 根据 pandas 中的条件删除 DataFrame 行的最有效方法是什么?

python - Pandas 数据帧的减法

machine-learning - 谷歌Colab : Can we restore all the data even after the runtime disconnects?

python - 如何折叠 Google Colab Notebook 中的代码部分但保持显示结果?

python - 当 Pandas Dataframe.Combine 或 DataFrame.Combine_First 时,您可以保留列顺序吗?

python - 如何过滤 pandas 数据框中的 NaN 行的连续数据行?

python - Pandas :根据条件向前填充

python - 如何在谷歌协作笔记本中显示 plotly 输出?

python - Colab Python : Downloading/Uploading google files without mounting

google-drive-api - 合作实验室: Can I access to my Google drive folder and file?