当前位置:网站首页>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]
边栏推荐
- Redis password modification, startup, view and other operations
- 241. Different Ways to Add Parentheses
- 基于SSM的小区垃圾分类和运输管理系统,高质量毕业论文范例(可直接使用),源码,数据库脚本,项目导入运行视频教程,论文撰写教程
- leetcode-区间dp
- leetcode 第 297 场周赛
- 342. Power of Four
- Starting Oracle under Linux
- 190. Reverse Bits
- If the programmer tells the truth during the interview
- 聊一聊数据库的行存与列存
猜你喜欢
随机推荐
47. Permutations II
Using Sqlalchemy for combined paging queries
File download vulnerability & file read vulnerability & file delete vulnerability
476. Number Complement
Views in MySQL
RobotFramework二次开发——文件解析
Acwing week 53
Stored procedures in MySQL
leetcode 1579. 保证图可完全遍历
769. Max Chunks To Make Sorted
46. Permutations
SQL and Oracle statements for eliminating duplicate records
Rf5.0 new content quick view
130. Surrounded Regions
155. Min Stack
从零开始写一个契约测试工具
318. Maximum Product of Word Lengths
【Nacos云原生】阅读源码第一步,本地启动Nacos
RCE&代码执行漏洞
JSP based library management system, including source code, database script, video tutorial for project operation, and video tutorial for thesis writing








