【问题标题】:Save excel file using python使用python保存excel文件
【发布时间】:2020-09-10 04:49:47
【问题描述】:

我有问题。我在 Jupiter notebook 中使用 python 对 excel 文件执行数据清理。我的 excel 文件中有 10 张工作表。我的清洁已成功完成。但是当我打开excel时,它和清洁前一样。如何使用 python pandas 将我的数据永久保存在 excel 文件中? 我使用 import os

导入文件

【问题讨论】:

标签: python pandas save


【解决方案1】:

首先你必须保存干净的数据,然后你可以直接打开那个文件

df.to_csv(location,index=False)

【讨论】:

  • 但是我的 excel 文件是 .xlsx 类型的,每当我尝试 df.to_excel(location, index=False) 时,它都不会保存我通过数据清理执行的更改。有什么解决办法吗?
  • df.to_excel("output.xlsx",index=False)
猜你喜欢
  • 1970-01-01
  • 2018-01-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-06
相关资源
最近更新 更多