[英]How to export result obtained from Python into excel
I did some analysis of my.txt file using python.我使用 python 对 my.txt 文件进行了一些分析。 Each data produced a set of results.
每个数据产生一组结果。 I need to transfer the whole results into a single excel file.
我需要将整个结果转移到一个 excel 文件中。 You can see my results from this image enter image description here .
您可以从这张图片中看到我的结果,在此处输入图片描述。 Also, I want to mention each txt file name along with the results in the excel sheet.
另外,我想在 excel 表中提及每个 txt 文件名以及结果。 Can anyone help this matter?
任何人都可以帮助解决这个问题吗?
I presume that you are using pandas.我假设您使用的是 pandas。 Pandas have a build in function to export to excel.
Pandas 有一个内置 function 以导出到 excel。
df_excel.to_excel("output.xlsx")
If you want to add the name of the textfile, simply add the name to the corresponding rows.如果要添加文本文件的名称,只需将名称添加到相应的行即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.