pandas中怎么将numpy数组导出并生成excel
pandas中怎么将numpy数组导出并生成excel,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
代码
# -*- coding: utf-8 -*- import numpy as np import pandas as pd # prepare for data data = np.arange(1,101).reshape((10,10)) data_df = pd.DataFrame(data) # change the index and column name data_df.columns = ['A','B','C','D','E','F','G','H','I','J'] data_df.index = ['a','b','c','d','e','f','g','h','i','j'] # create and writer pd.DataFrame to excel writer = pd.ExcelWriter('Save_Excel.xlsx') data_df.to_excel(writer,'page_1',float_format='%.5f') # float_format 控制精度 writer.save()
How to move one row to the first in pandas?
create a new dataframe object use .reindex([...]) attribute/method
关于pandas中怎么将numpy数组导出并生成excel问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注行业资讯频道了解更多相关知识。