python - 如何连接numpy数组?
问题描述
如何连接numpy数组?
我想连接所有 numpy 数组。
例如,有一些 numpy 数组如下
a = numpy.array([1,2,3])
b = numpy.array([4,5,6])
c = numpy.array([7,8,9])
将它们全部连接起来。
我们需要一个额外的空变量。
tot = numpy.concatenate(tot, a)
tot = numpy.concatenate(tot, b)
tot = numpy.concatenate(tot, c)
如何声明全部为空变量?(如果数组太多?)
解决方案
你需要它们在一个元组中:
>>> tot = numpy.concatenate((a,b,c))
>>> tot
array([1, 2, 3, 4, 5, 6, 7, 8, 9])
推荐阅读
- ios - 用于播放来自套接字的 wav 文件的 iOS 库
- python - 如何正确导入 numpy?
- javascript - 当我的变量中有“#”时,为什么字符串不能正确传递给服务器?
- android - Android 测试 - 如何在 UI 上点击 OpenGL 资源?
- computer-science - 是否有数学证据表明语义错误检测系统设计是不可能设计的?
- php - 如何在ajax json中使用动态输入名称变量
- asterisk - 队列调用策略
- google-apps-script - 使用 GAS 图表设置条形边框颜色和权重
- excel - Excel VBA 用户表单组合框 - 加载多列值
- java - 单击具有相同名称的不同html类