当前位置:网站首页>Numpy append function
Numpy append function
2022-04-23 02:56:00 【Live up to your youth】
The function prototype
numpy.append(arr, values, axis=None)
Function interpretation
Add elements at the end of the array , According to the shape of the data, it can be added from different dimensions ; If not specified axis, Then the array is flattened into a one-dimensional array .
The usage function
>>> a = np.zeros((2, 2, 2))
>>> a
array([[[0., 0.],
[0., 0.]],
[[0., 0.],
[0., 0.]]])
>>> b = np.zeros((1, 2, 2))
>>> b
array([[[0., 0.],
[0., 0.]]])
# Is not specified axis
>>> c = np.append(a, b)
>>> c
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
# stay axis=0 Add
>>> d = np.append(a, b, axis=0)
>>> d
array([[[0., 0.],
[0., 0.]],
[[0., 0.],
[0., 0.]],
[[0., 0.],
[0., 0.]]])
>>> e = np.zeros((2, 1, 2))
>>> e
array([[[0., 0.]],
[[0., 0.]]])
>>> f = np.append(a, e, axis=1)
>>> f
array([[[0., 0.],
[0., 0.],
[0., 0.]],
[[0., 0.],
[0., 0.],
[0., 0.]]])
>>> g = np.zeros((2, 2, 1))
>>> g
array([[[0.],
[0.]],
[[0.],
[0.]]])
>>> h = np.append(a, g, axis=2)
>>> h
array([[[0., 0., 0.],
[0., 0., 0.]],
[[0., 0., 0.],
[0., 0., 0.]]])
版权声明
本文为[Live up to your youth]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220657127509.html
边栏推荐
- Modification du contenu de la recherche dans la boîte déroulante par PHP + MySQL
- win查看端口占用 命令行
- The space between the left and right of the movie ticket seats is empty and cannot be selected
- MySQL insert free column
- Chapter V project quality management of information system project manager summary
- [hcip] detailed explanation of six LSAS commonly used by OSPF
- Store consumption SMS notification template
- If MySQL / SQL server judges that the table or temporary table exists, it will be deleted
- 工业互联网+危化安全生产综合管理平台怎样建
- Interpretation of the future development of smart agriculture
猜你喜欢
期中汇总(概论+应用层+运输层)
How to use C language to realize [guessing numbers game]
How to build an integrated industrial Internet plus hazardous safety production management platform?
Innovation and management based on Scrum
The input of El input input box is invalid, and error in data(): "referenceerror: El is not defined“
LeetCode 1450 - 1453
grain rain
解决win7 中powershell挖矿占用CPU100%
Flink learning (XI) watermark
Traversée de l'arbre L2 - 006
随机推荐
Traversée de l'arbre L2 - 006
Classification and regression tree of machine learning
Fashion MNIST dataset classification training
期中汇总(概论+应用层+运输层)
Airtrack cracking wireless network password (Dictionary running method)
《信息系统项目管理师总结》第七章 项目沟通管理
The space between the left and right of the movie ticket seats is empty and cannot be selected
MySQL insert free column
Shell learning notes -- shell processing of output stream awk
Typescript Learning Guide
Android high-level interview must ask: overall business and project architecture design and reconstruction
leangoo脑图-共享式多人协作思维导图工具分享
Encapsulation of ele table
Devil cold rice 𞓜 078 devil answers the market in Shanghai and Nanjing; Communication and guidance; Winning the country and killing and screening; The purpose of making money; Change other people's op
Machine learning (Zhou Zhihua) Chapter 14 probability graph model
eventBus
Winsock programming interface experiment: Ping
OCR识别PDF文件
It turns out that PID was born in the struggle between Lao wangtou and Lao sky
AC380V drop 5v12v24v200ma, UHV non isolated chip IC scheme