利用pandas将numpy数组导出生成excel的实例
作者:GoAmterLiu 时间:2021-03-10 02:43:14
上图
代码
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 18 20:57:34 2017
@author: Bruce Lau
"""
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
来源:https://blog.csdn.net/qq_33039859/article/details/73440782
标签:pandas,numpy,excel
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
超强多功能php绿色集成环境详解
2023-07-15 01:07:22
![](https://img.aspxhome.com/file/2023/2/55472_0s.jpg)
TensorFlow固化模型的实现操作
2022-09-12 22:28:42
python+selenium实现京东自动登录及秒杀功能
2021-02-08 13:31:41
python基础教程之csv格式文件的写入与读取
2021-05-24 09:20:12
![](https://img.aspxhome.com/file/2023/7/75187_0s.png)
python return实现汇率转换器教程示例
2023-11-10 12:39:50
![](https://img.aspxhome.com/file/2023/3/63623_0s.png)
CSS3 + HTML5 实现未来 Web 设计
2010-01-25 12:17:00
![](https://img.aspxhome.com/file/UploadPic/20101/25/232021rjs-74s.png)
精简高效的CSS命名准则和方法
2010-09-17 18:38:00
![](https://img.aspxhome.com/file/UploadPic/20109/17/01-44s.jpg)
Python面向对象程序设计示例小结
2023-08-24 13:31:24
Python jiaba库的使用详解
2022-05-11 22:20:46
![](https://img.aspxhome.com/file/2023/2/97522_0s.png)
python logging日志模块的详解
2021-04-27 19:16:55
python自动化测试无法启动谷歌浏览器问题
2021-01-08 21:35:54
![](https://img.aspxhome.com/file/2023/8/117948_0s.png)
删除PHP数组中的重复元素的实现代码
2023-06-06 21:19:46
![](https://img.aspxhome.com/file/2023/0/55470_0s.png)
介绍Python中几个常用的类方法
2023-02-10 09:17:49
python logging模块的分文件存放详析
2023-04-02 20:27:32
![](https://img.aspxhome.com/file/2023/8/97538_0s.png)
python安装教程 Pycharm安装详细教程
2022-08-08 02:25:55
![](https://img.aspxhome.com/file/2023/2/68412_0s.jpg)
python中实现数组和列表读取一列的方法
2021-04-07 08:04:48
Python 添加命令行参数步骤
2022-10-24 05:15:40
![](https://img.aspxhome.com/file/2023/3/80723_0s.png)
简单介绍Python的Tornado框架中的协程异步实现原理
2021-06-21 10:00:23
查看ASP详细错误提示信息的图文设置方法
2011-02-05 11:02:00
![](https://img.aspxhome.com/file/UploadPic/20112/5/20112511339472s.jpg)
解决django服务器重启端口被占用的问题
2023-11-10 14:14:12
![](https://img.aspxhome.com/file/2023/1/105441_0s.jpg)