Python:连接3个数组 [英] Python: Concatenate 3 arrays

查看:67
本文介绍了Python:连接3个数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有theee数组,想合并它们

I have theee arrays, and want to combine them

import numpy as np
a = np.array([[1,2,3],[4,5,6]])
b = np.array([[7,8,9],[10,11,12]])
c = np.array([[13,14,15],[16,17,18]])

获得:

array([1,2,3,7,8,9,13,14,15, 4,5,6,10,11,12,16,17,18])

此功能是什么?

谢谢:)

推荐答案

使用 np.hstack 并用 np.ravel -

np.hstack(( a,b,c )).ravel()

这篇关于Python:连接3个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆