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() # 保存