当前位置:网站首页>Consolidation of common functions of numpy Library
Consolidation of common functions of numpy Library
2022-06-22 13:36:00 【A hundred years of literature have been written on the left sid】
Numpy Library common functions
One 、 Horizontal consolidation and vertical consolidation
1 Horizontal merger
There are already two matrices A and B
If you add two matrices left and right, it becomes [A B], So use numpy.c_, Be similar to pandas In the library merge()
import numpy as np
#A
#1 2 3
#4 5 6
A = np.array([[1,2,3],[4,5,6]])
#B
#11 12
#13 14
B = np.array([[11,12],[13,14]])
#C
#1 2 3 11 12
#4 5 6 13 14
C = np.c_[A, B]
2 Vertical merger
There are already two matrices A and B
If you want to add two matrices up and down, it becomes
[A
B], So use numpy.r_, Be similar to pandas In the library concat()
import numpy as np
#A
#1 2 3
#4 5 6
A = np.array([[1,2,3],[4,5,6]])
#B
#11 12 13
B = np.array([[11,12,13]])
#C
#1 2 3
#4 5 6
#11 12 13
C = np.r_[A, B]
边栏推荐
- 卸载MySQL 8
- 基于SSM的小区垃圾分类和运输管理系统,高质量毕业论文范例(可直接使用),源码,数据库脚本,项目导入运行视频教程,论文撰写教程
- 190. Reverse Bits
- leetcode 834. 树中距离之和
- Secondary development of robotframework - real time log
- Leetcode daily question 202110
- 性能相关指标
- leetcode-子序列/子串问题
- Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology
- Docker installing PostgreSQL
猜你喜欢

Docker installing PostgreSQL

MySQL中的存储过程

Leetcode daily question 202110

在CSDN写文几年,我出了“第一本书“,感恩!

leetcode-数学题

240. Search a 2D Matrix II

257. Binary Tree Paths

别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!

Acwing week 53

Système de classification des déchets et de gestion des transports basé sur SSM, exemple de thèse de diplôme de haute qualité (peut être utilisé directement), code source, script de base de données, t
随机推荐
318. Maximum Product of Word Lengths
Linux setting enables Oracle10g to start automatically
Oracle cursor
Record the solution of failing to log in after the alicloud ECS instance is restarted (hands-on practice)
241. Different Ways to Add Parentheses
leetcode 834. 树中距离之和
RobotFramework中setUp的小技巧
leetcode 99. Restore binary search tree
SQL and Oracle statements for eliminating duplicate records
RobotFramework二次开发——文件解析
6月《中国数据库行业分析报告》发布!智能风起,列存更生
性能相关指标
Système de classification des déchets et de gestion des transports basé sur SSM, exemple de thèse de diplôme de haute qualité (peut être utilisé directement), code source, script de base de données, t
RF5.0新内容速看
Query rewriting for opengauss kernel analysis
AcWing第54场周赛
693. Binary Number with Alternating Bits
Writing a contract testing tool from scratch -- database design
SSM based community garbage classification and transportation management system, high-quality graduation thesis example (can be used directly), source code, database script, project introduction and o
毕业论文写作中致谢词的常见写法及优秀范文