当前位置:网站首页>np. Understanding of axis in concatenate
np. Understanding of axis in concatenate
2022-06-13 01:06:00 【Thinking and Practice】
Parameters in official documents
concatenate(...)
concatenate((a1, a2, ...), axis=0)
Join a sequence of arrays along an existing axis.
Parameters
----------
a1, a2, ... : sequence of array_like
The arrays must have the same shape, except in the dimension
corresponding to `axis` (the first, by default).
axis : int, optional
The axis along which the arrays will be joined. Default is 0.
Return
array.shape,axis=0 Is to operate on the first dimension ,
axis=1 That's right 2 Operate on multiple dimensions ,
axis=2 That's right 3 Operate on multiple dimensions , And so on …
The first dimension is along x Splice in the direction , That is, the matrix is spliced up and down ; The second dimension is along y Splice in the direction , That is, the matrix and the matrix are spliced left and right ; The third dimension is along z Splice in the direction , That is, to put the matrix and the matrix together .(x,y The direction is the normal axis direction )
Be careful : When splicing, you must pay attention to the dimension , like axis=0, To splice up and down , Then the number of columns of the two matrices must be the same ;axis=1 The same number of lines ;axis=2 That is, the number of rows and columns are the same .
————————————————
Copyright notice : This paper is about CSDN Blogger 「ly_ljs_521」 The original article of , follow CC 4.0 BY-SA Copyright agreement , For reprint, please attach the original source link and this statement .
Link to the original text :https://blog.csdn.net/ly_ljs_521/article/details/123204684
Example
a = np.array([[1, 2], [3, 4]])
b = np.array([[5, 6]])
np.concatenate((a, b), axis=0) # there axis=0 Is merged by rows
array([[1, 2],
[3, 4],
[5, 6]])
a = np.array([[1, 2], [3, 4]])
b = np.array([[5, 6]])
np.concatenate((a, b.T), axis=1) # there axis=1 Is merged by column
array([[1, 2, 5],
[3, 4, 6]])
Reference material
In depth learning concatenate Use _alxe_made The blog of -CSDN Blog _concatenate
np.concatenate() Instructions _Tchunren The blog of -CSDN Blog _np.concat
边栏推荐
- Androi weather
- How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of vrsi, bbiboll, WR, bias and RSI indicators
- Opencv desaturation
- [imx6ull] video monitoring project (USB camera +ffmepeg)
- Status of the thread
- Dynamic planning - good article link
- Deadlock problem summary
- Leetcode-17- letter combination of phone number (medium)
- The scope builder coroutinescope, runblocking and supervisorscope of kotlin collaboration processes run synchronously. How can other collaboration processes not be suspended when the collaboration pro
- Ecological convergence NFT attacks, metaverse ape leads the new paradigm revolution of Web 3.0 meta universe
猜你喜欢

408 true question - division sequence

leetcode 142. Circular linked list II
![[JS component] browse progress bar](/img/cb/913f446db2cacdb965a3bf619aa478.jpg)
[JS component] browse progress bar

Common skills for quantitative investment - drawing 3: drawing the golden section line

Canvas random bubbling background
![[JS component] customize the right-click menu](/img/a3/4555619db17e4c398e72c7d6b12f5d.jpg)
[JS component] customize the right-click menu

spiral matrix visit Search a 2D Matrix

Deep learning model pruning

Breadth first search for node editor runtime traversal

The scope builder coroutinescope, runblocking and supervisorscope of kotlin collaboration processes run synchronously. How can other collaboration processes not be suspended when the collaboration pro
随机推荐
Pipeline流水线项目构建
Aof persistence
[JS component library] drag sorting component
Go simple read database
Leetcode-16- sum of the nearest three numbers (medium)
Tangent and tangent plane
Can GPU acceleration pytorch work?
Opencv desaturation
数学知识整理:极值&最值,驻点,拉格朗日乘子
Canvas random bubbling background
ArrayList underlying source code
Physical orbit simulation
论文笔记:STMARL: A Spatio-Temporal Multi-AgentReinforcement Learning Approach for Cooperative Traffic
304. Merge two ordered arrays
leetcode 142. Circular linked list II
Unity calls alertdialog
Leetcode-17- letter combination of phone number (medium)
np.concatenate中axis的理解
Application advantages of 5g industrial gateway in coal industry
软件测试的几种分类,一看就明了