【问题标题】:Export Google Colab Notebook to csv file将 Google Colab Notebook 导出为 csv 文件
【发布时间】:2022-08-19 18:38:15
【问题描述】:

我需要将 Google Colab 上的 for 循环的结果下载到 csv 文件中,但我无法做到。

这是我的 for 循环:

for num in range(1, 101):
  if ( num%2 == 0 and num%6 != 0) or (num%3 ==0 and num%6 != 0):
    list = print(num)

笔记本名为 AHW1.ipynb

我试过了:

from google.colab import files
files.download(\"AHW1.csv\")

我该怎么做才能将此 for 循环的结果下载为 csv 文件?

    标签: google-colaboratory


    【解决方案1】:

    #数据分析库 将 numpy 导入为 np 将熊猫导入为 pd

    #可视化库 将 matplotlib.pyplot 导入为 plt 将 seaborn 导入为 sns %matplotlib 内联

    #忽略警告 导入警告 警告.filterwarnings('忽略')

    【讨论】:

      猜你喜欢
      • 2019-05-22
      • 2019-08-03
      • 2018-07-06
      • 2021-11-19
      • 2020-06-06
      • 2020-07-07
      • 2021-02-14
      • 2022-11-11
      • 2020-03-15
      相关资源
      最近更新 更多