当前位置:网站首页>numpy.concatenate
numpy.concatenate
2022-07-24 07:23:00 【Wanderer001】
numpy.concatenate((a1, a2, ...), axis=0, out=None)
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).
axisint, optional
The axis along which the arrays will be joined. If axis is None, arrays are flattened before use. Default is 0.
outndarray, optional
If provided, the destination to place the result. The shape must be correct, matching that of what concatenate would have returned if no out argument were specified.
Returns
resndarray
The concatenated array.
See also
Concatenate function that preserves input masks.
Split an array into multiple sub-arrays of equal or near-equal size.
Split array into a list of multiple sub-arrays of equal size.
Split array into multiple sub-arrays horizontally (column wise)
Split array into multiple sub-arrays vertically (row wise)
Split array into multiple sub-arrays along the 3rd axis (depth).
Stack a sequence of arrays along a new axis.
Stack arrays in sequence horizontally (column wise)
Stack arrays in sequence vertically (row wise)
Stack arrays in sequence depth wise (along third dimension)
Assemble arrays from blocks.
Notes
When one or more of the arrays to be concatenated is a MaskedArray, this function will return a MaskedArray object instead of an ndarray, but the input masks are not preserved. In cases where a MaskedArray is expected as input, use the ma.concatenate function from the masked array module instead.
Examples
>>> a = np.array([[1, 2], [3, 4]])
>>> b = np.array([[5, 6]])
>>> np.concatenate((a, b), axis=0)
array([[1, 2],
[3, 4],
[5, 6]])
>>> np.concatenate((a, b.T), axis=1)
array([[1, 2, 5],
[3, 4, 6]])
>>> np.concatenate((a, b), axis=None)
array([1, 2, 3, 4, 5, 6])This function will not preserve masking of MaskedArray inputs.
>>> a = np.ma.arange(3)
>>> a[1] = np.ma.masked
>>> b = np.arange(2, 5)
>>> a
masked_array(data=[0, --, 2],
mask=[False, True, False],
fill_value=999999)
>>> b
array([2, 3, 4])
>>> np.concatenate([a, b])
masked_array(data=[0, 1, 2, 2, 3, 4],
mask=False,
fill_value=999999)
>>> np.ma.concatenate([a, b])
masked_array(data=[0, --, 2, 2, 3, 4],
mask=[False, True, False, False, False, False],
fill_value=999999)边栏推荐
猜你喜欢
![[leetcode simple] 20. Valid brackets stack](/img/49/b3dce4ee0987c98f195e0f7f558d8f.png)
[leetcode simple] 20. Valid brackets stack

C language from entry to soil (III)

C language from entry to soil (I)

Traditional e-commerce dividends disappear, how to enter the new social e-commerce?

安全工具之hackingtool

Pytorch deep learning practice lesson 10 / assignment (basic CNN)

单点登录的三种实现方式

论文阅读:HarDNet: A Low Memory Traffic Network

变量和数据类型(03)
![[FreeRTOS] 11 software timer](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[FreeRTOS] 11 software timer
随机推荐
django.db.utils. OperationalError: (2002, “Can‘t connect to local MySQL server through socket ‘/var/r
【时序逻辑电路】——寄存器
MySQL语句
C language from entry to soil (II)
InjectFix原理学习(实现修复加法的热更)
AMD64 (x86_64) architecture ABI document: upper
RIoTBoard开发板系列笔记(九)—— buildroot 移植MatchBox
Chapter007-FPGA学习之IIC总线EEPROM读取
【PTA】团体程序设计天梯赛-练习集 L3题目总结(不全)
Do you really know the judgement sentence?
C language to achieve three chess? Gobang? No, it's n-chess
【Tips】创建版本控制项目的简单方法
C language from entry to Earth - array
django.db.utils.OperationalError: (2002, “Can‘t connect to local MySQL server through socket ‘/var/r
给一个字符串 ① 请统计出其中每一个字母出现的次数② 请打印出字母次数最多的那一对
[tips] a simple method to create a version control project
File "manage.py", line 14) from exc ^ syntaxerror: cause and solution of invalid syntax error
Harbor2.2 用户角色权限速查
23.组件自定义事件
stdafx.h 简介及作用