numpy hstack()
2024-10-21 15:42:01
numpy.
hstack
(tup)[source]-
Stack arrays in sequence horizontally (column wise).
Take a sequence of arrays and stack them horizontally to make a single array. Rebuild arrays divided by
hsplit
.This function continues to be supported for backward compatibility, but you should prefer
np.concatenate
ornp.stack
. Thenp.stack
function was added in NumPy 1.10.Parameters: tup : sequence of ndarrays
All arrays must have the same shape along all but the second axis.
Returns: stacked : ndarray
The array formed by stacking the given arrays.
See also
stack
- Join a sequence of arrays along a new axis.
vstack
- Stack arrays in sequence vertically (row wise).
dstack
- Stack arrays in sequence depth wise (along third axis).
concatenate
- Join a sequence of arrays along an existing axis.
hsplit
- Split array along second axis.
block
- Assemble arrays from blocks.
Notes
Equivalent to
np.concatenate(tup, axis=1)
if tup contains arrays that are at least 2-dimensional.Examples
>>> a = np.array((1,2,3))
>>> b = np.array((2,3,4))
>>> np.hstack((a,b))
array([1, 2, 3, 2, 3, 4])
>>> a = np.array([[1],[2],[3]])
>>> b = np.array([[2],[3],[4]])
>>> np.hstack((a,b))
array([[1, 2],
[2, 3],
[3, 4]])
官网:https://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html
函数具体实现:https://github.com/numpy/numpy/blob/v1.13.0/numpy/core/shape_base.py#L239-L293
最新文章
- IOS-Hybrid(混合开发)
- nodejs+easyui(抽奖活动后台)增删改查
- Flyweight(享元)--对象结构型模式
- 【C++】DDX_Control、SubclassWindow和SubclassDlgItem的区别
- jq里延迟对象Deferred,状态变化后,会一直保持
- php 依赖注入
- 微信浏览器里location.reload问题
- CSS制作一个简单网页的下拉导航栏
- UserAccountInfo时间倒计时
- 转:使用memc-nginx和srcache-nginx模块构建高效透明的缓存机制
- Arrays 类操作 Java 的数组排序
- Linux下Openfire相关安装和配置
- 【Hibernate学习】 ——ORM(三)
- 深入浅出了解frame和bounds
- .net 4种单例模式
- Spider与OpenPyXL的结合
- JavaScript(八)
- 【转】python3解析库lxml
- C#往SQLServer中插入大数据
- ALTER数据库
热门文章
- java 利用c3p0管理数据库连接池
- Scrapy框架的基本组成及功能使用
- CF1149A Prefix Sum Primes
- c语言中的->;代表什么意思
- springMVC 中 ajax get 请求和 post 请求的坑以及参数传递
- bzoj 2658
- WPF知识点全攻略07- 数据绑定(Binding)
- [置顶] IIS应用程序池多工作进程设置及Session共享
- PAT (Basic Level) Practise (中文)-1028. 人口普查(20)
- GloVe:另一种Word Embedding方法