当前位置:网站首页>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
边栏推荐
- Common skills for quantitative investment - indicators Chapter 3: detailed explanation of RSI indicators, their code implementation and drawing
- Application advantages of 5g industrial gateway in coal industry
- 軟件測試的幾種分類,一看就明了
- Unity calls alertdialog
- Common skills of quantitative investment -- Drawing Part 1: Drawing stock closing price curve and ochl candle chart
- . The way to prove the effect of throwing exceptions on performance in. Net core
- [server data recovery] successful cases of data loss recovery during data migration between storage servers
- The tle4253gs is a monolithic integrated low dropout tracking regulator in a small pg-dso-8 package.
- [backtrader source code analysis 7] analysis of the functions for calculating mean value, variance and standard deviation in mathsupport in backtrader (with low gold content)
- Argparse command line passes list type parameter
猜你喜欢
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic benefits of ASI, VR, arbr, DPO and trix indicators
Tangent and tangent plane
Minimum spanning tree problem
[JS] battle chess
MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)
Wal mechanism of MySQL
[JS component] previous queue prompt
ArrayList underlying source code
五篇经典好文,值得一看(2)
spiral matrix visit Search a 2D Matrix
随机推荐
. The way to prove the effect of throwing exceptions on performance in. Net core
707. design linked list
Mysql database password modification
Loss calculation in pytorch
Canvas game lower level 100
Deep learning model pruning
软件测试的几种分类,一看就明了
Binary tree -- using hierarchical sequence and middle sequence to determine a tree
Binary tree - right view
Five classic articles worth reading (2)
[JS component] browse progress bar
Application advantages of 5g industrial gateway in coal industry
深度学习训练多少轮?迭代多少次?
MySQL index
Quick power explanation
Deadlock problem summary
leetcode. 349. intersection of two arrays
[imx6ull] video monitoring project (USB camera +ffmepeg)
[JS component] dazzle radio box and multi box
蓝桥杯单片机第七届决赛