import numpy as np
import pandas as pd
import openpyxl
data_df = pd.DataFrame(mean)
data_df.columns = ['A','B','C','D','E','F','G','H','I','J'] #将第一行的0,1,2,...,9变成A,B,C...
data_df.index = ['a','b','c','d','e','f','g','h','i','j']
writer = pd.ExcelWriter('test.xlsx') # 创建名称为test的excel表格
data_df.to_excel(writer, 'page_1',
float_format='%.2f') # float_format 精度,将data_df写到test表格的第一页中。若多个文件,可以在page_2中写入
writer.save() # 保存
#读者可以自己调一调参数,看看结果如何
相关文章
- 02-29python – 将函数从sympy转换为numpy(属性错误)
- 02-29python – 填充numpy数组的对角线失败
- 02-29python – 在2D numpy数组中对角插入元素的最快方法是什么?
- 02-29python – 在numpy数组中更改的值
- 02-29python-重新采样并调整numpy数组的大小
- 02-29python-NumPy-将数组重塑为一维
- 02-29python – numpy的多个数组的平均值,不考虑零值
- 02-29将element ui el-table中的数据导出到excel中
- 02-29js 将table中的数据导出为excel文件
- 02-29python – 使用ctypes数组作为numpy数组时的PEP 3118警告