当前位置:网站首页>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
边栏推荐
- Looking for a job, writing a resume to an interview, this set of information is enough!
- JZ22 鏈錶中倒數最後k個結點
- php+mysql對下拉框搜索的內容修改
- Linux Redis——Redis 数据库缓存服务
- Navicat premium import SQL file
- 机器学习(周志华) 第十四章概率图模型
- VirtualBox virtual machine (Oracle VM)
- php+mysql对下拉框搜索的内容修改
- Log4j knowledge point record
- C language 171 Number of recent palindromes
猜你喜欢

期中汇总(概论+应用层+运输层)

Interpretation of the future development of smart agriculture

解决win7 中powershell挖矿占用CPU100%

BLDC double closed loop (speed PI + current PI) Simulink simulation model

Solve the problem that PowerShell mining occupies 100% of cpu7 in win7

Innovation and management based on Scrum

基于ele封装下拉菜单等组件

Interim summary (Introduction + application layer + transportation layer)

Leangoo brain map - shared multi person collaborative mind mapping tool
![[hcip] detailed explanation of six LSAS commonly used by OSPF](/img/31/3b92d42d16a056bf9db9e24471cefd.jpg)
[hcip] detailed explanation of six LSAS commonly used by OSPF
随机推荐
Plug in for vscode
OCR识别PDF文件
《信息系统项目管理师总结》第四章 项目成本管理
MySQL复杂查询使用临时表/with as(类似表变量)
接口请求时间太长,jstack观察锁持有情况
进阶上将程序员必备素质
Wepy learning record
Slave should be able to synchronize with the master in tests/integration/replication-psync. tcl
Slave should be able to synchronize with the master in tests/integration/replication-psync.tcl
Learn regular expression options, assertions
leangoo脑图-共享式多人协作思维导图工具分享
[if you want to do a good job, you must first use its tools] Guide for downloading and using paper editing and document management (endnote, latex, jabref, overflow) resources
The way to conquer C language
How to use C language to realize [guessing numbers game]
First knowledge of C language ~ branch statements
Log cutting - build a remote log collection server
Close the computer port
MySQL insert free column
Restart redis
Navicat failed to connect to Oracle Database: cannot load OCI DLL, 87: instant client package is