Python 保存矩阵为Excel的实现方法
作者:美酒爱尔兰 时间:2022-07-23 07:05:00
如下所示:
def save(data, path):
f = xlwt.Workbook() # 创建工作簿
sheet1 = f.add_sheet(u'sheet1', cell_overwrite_ok=True) # 创建sheet
[h, l] = data.shape # h为行数,l为列数
for i in range(h):
for j in range(l):
sheet1.write(i, j, data[i, j])
f.save(path)
代码简单,但是常用!
来源:https://blog.csdn.net/Ling_cmd/article/details/81063794
标签:Python,矩阵,Excel
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
5个充满想象力的Web调色板
2008-08-02 12:55:00
![](https://img.aspxhome.com/file/UploadPic/20088/2/200882125923403s.png)
ASP生成静态页面的方法
2010-05-27 12:13:00
asp fso操作类
2011-03-07 10:57:00
Python实现 PS 图像调整中的亮度调整
2021-04-02 20:08:54
Yahoo! BrowserPlus 发布
2008-11-20 13:35:00
基于Python搭建人脸识别考勤系统
2021-07-08 10:17:42
![](https://img.aspxhome.com/file/2023/9/78759_0s.jpg)
如何创建CSS的对象,获取合适的粒度
2010-07-09 13:10:00
![](https://img.aspxhome.com/file/UploadPic/20107/9/02-19s.jpg)
asp如何向客户端发送提示“出错信息”?
2010-06-09 18:50:00
探索网页设计中的黄金比例
2008-10-20 12:26:00
![](https://img.aspxhome.com/file/UploadPic/200810/20/20081020123431560s.png)
教你怎么用Python监控愉客行车程
2021-10-22 17:59:37
![](https://img.aspxhome.com/file/2023/3/77753_0s.png)
将字符实体引用转换成 Unicode 字符
2011-07-01 12:31:51
google 的设计原则和LOGO手绘
2008-05-20 12:16:00
![](https://img.aspxhome.com/file/UploadPic/20085/20/2008520122313977s.gif)
细化解析:MySQL 搜索中的大小写敏感性
2008-11-27 15:53:00
mysql中普通索引和唯一索引的效率对比
2010-12-08 16:03:00
![](https://img.aspxhome.com/file/UploadPic/201012/8/2010128165343945s.jpg)
python打开url并按指定块读取网页内容的方法
2023-07-07 11:00:36
Django查询优化及ajax编码格式原理解析
2021-04-26 02:04:27
python Django编写接口并用Jmeter测试的方法
2021-12-07 21:47:09
![](https://img.aspxhome.com/file/2023/2/68372_0s.png)
什么是Ajax及Ajax的优势
2007-09-07 09:56:00
![](https://img.aspxhome.com/file/UploadPic/up/2007091821580144.jpg)
Django+Celery实现定时任务的示例
2023-07-27 19:48:18
![](https://img.aspxhome.com/file/2023/4/61704_0s.png)
python使用pyaudio录音和格式转化方式
2023-11-07 19:30:03