当前位置:网站首页>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]
边栏推荐
- 测试方法论——数据驱动测试
- Linux setting enables Oracle10g to start automatically
- 【Nacos云原生】阅读源码第一步,本地启动Nacos
- leetcode 1130. 叶值的最小代价生成树
- Write a contract testing tool from scratch
- leetcode 854. String with similarity K
- leetcode 85. Max rectangle
- Leetcode subsequence / substring problem
- 从零开始写一个契约测试工具
- “不敢去怀疑代码,又不得不怀疑代码”记一次网络请求超时分析
猜你喜欢

File download vulnerability & file read vulnerability & file delete vulnerability

leetcode-背包问题

“不敢去懷疑代碼,又不得不懷疑代碼”記一次網絡請求超時分析

剑指 Offer II 114. 外星文字典

Leetcode dichotomy

leetcode 1579. Ensure that the graph can be completely traversed

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

PHP反序列化&魔术方法

Leetcode game 297

Stored procedures in MySQL
随机推荐
epoch_ Num and predict_ Conversion of num
Rigid demand of robot direction → personal thinking ←
448. Find All Numbers Disappeared in an Array
Andrdoid delay operation
leetcode-子序列/子串問題
文件下载漏洞&文件读取漏洞&文件删除漏洞
leetcode 968.监控二叉树
260. Single Number III
leetcode 99.恢复二叉搜索树
MySQL中的视图
File download vulnerability & file read vulnerability & file delete vulnerability
Acwing 241 Loulan totem (detailed explanation of tree array)
PHP deserialization & Magic method
Tips of setup in robotframework
448. Find All Numbers Disappeared in an Array
338. Counting Bits
别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
Leetcode daily question 202110
Number of times Oracle uses cursor to decompose numbers
Growth knowledge network