当前位置:网站首页>numpy.concatenate
numpy.concatenate
2022-07-24 07:02: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)边栏推荐
- QoS quality of service 4 traffic regulation of QoS boundary behavior
- Use dichotomy to find specific values from the array
- 第二部分—C语言提高篇_2. 内存分区
- win10声音图标有个没有声音
- Job search memo
- Do you really know the judgement sentence?
- Take you to learn C step by step (second)
- Part II - C language improvement_ 3. Pointer reinforcement
- What kind of mode can make platform users self-help fission- Chain 2+1
- cloud的版本升级
猜你喜欢

Part I - Fundamentals of C language_ 11. Comprehensive project - greedy snake

文件上传下载Demo

Hackingtool of security tools

C language from introduction to soil -- super detailed summary of operators

Customization or GM, what is the future development trend of SaaS in China?

Variables and data types (03)

第二部分—C语言提高篇_3. 指针强化

第一部分—C语言基础篇_11. 综合项目-贪吃蛇

From the perspective of CIA, common network attacks (blasting, PE, traffic attacks)

Mongodb application scenario and model selection (massive data storage model selection)
随机推荐
The function of extern, static, register, volatile keywords in C language; Nanny level teaching!
cookie_session
QoS服务质量四QoS边界行为之流量监管
变量和数据类型(03)
Input some data and find the maximum output. (keyboard and file reading)
C language from entry to soil function
2D目标检测综述之学习策略篇(终章)
Customization or GM, what is the future development trend of SaaS in China?
UNI-APP_小程序或h5页面背景音乐的播放与暂停
Part II - C language improvement_ 2. Memory partition
A great hymn
MongoDB应用场景及选型(海量数据存储选型)
Vs2019 configuration running open3d example
[PTA] group programming ladder competition - Summary of exercises L3 (incomplete)
C language from entry to soil (III)
Use dichotomy to find specific values from the array
Use of redis
Basic syntax of MySQL DDL and DML and DQL
重磅直播 | ORB-SLAM3系列代码讲解地图点(专题二)
安全工具之hackingtool