Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 按行连接三维numpy阵列_Python_Arrays_Numpy_Concatenation_Row - Fatal编程技术网

Python 按行连接三维numpy阵列

Python 按行连接三维numpy阵列,python,arrays,numpy,concatenation,row,Python,Arrays,Numpy,Concatenation,Row,我有以下两个要连接的3D numpy数组。阵列如下所示: a=np.array([[1,1,1], [2,2,2], [3,3,3]], [“a”、“a”、“a”], [“b”、“b”、“b”], [“c”、“c”、“c”]] b=np.数组([[4,4,4], [5,5,5], [6,6,6], [7,7,7], [8,8,8], [9,9,9]], [“d”、“d”、“d”], [“e”、“e”、“e”], [“f”、“f”、“f”], [“g”、“g”、“g”], [“h”、“h”、“

我有以下两个要连接的3D numpy数组。阵列如下所示:

a=np.array([[1,1,1],
[2,2,2], 
[3,3,3]],
[“a”、“a”、“a”],
[“b”、“b”、“b”],
[“c”、“c”、“c”]]
b=np.数组([[4,4,4],
[5,5,5], 
[6,6,6],
[7,7,7],
[8,8,8],
[9,9,9]],
[“d”、“d”、“d”],
[“e”、“e”、“e”],
[“f”、“f”、“f”],
[“g”、“g”、“g”],
[“h”、“h”、“h”],
[“我”、“我”、“我”]]
我想将两个阵列连接成一个3D阵列,如下所示:

[[['1' '1' '1']
  ['2' '2' '2']
  ['3' '3' '3']
  ['4' '4' '4']
  ['5' '5' '5']
  ['6' '6' '6']
  ['7' '7' '7']
  ['8' '8' '8']
  ['9' '9' '9']]

 [['a' 'a' 'a']
  ['b' 'b' 'b']
  ['c' 'c' 'c']
  ['d' 'd' 'd']
  ['e' 'e' 'e']
  ['f' 'f' 'f']
  ['g' 'g' 'g']
  ['h' 'h' 'h']
  ['i' 'i' 'i']]]
如何做到这一点?

使用:

输出:

array([[['1', '1', '1'],
        ['2', '2', '2'],
        ['3', '3', '3'],
        ['4', '4', '4'],
        ['5', '5', '5'],
        ['6', '6', '6'],
        ['7', '7', '7'],
        ['8', '8', '8'],
        ['9', '9', '9']],

       [['a', 'a', 'a'],
        ['b', 'b', 'b'],
        ['c', 'c', 'c'],
        ['d', 'd', 'd'],
        ['e', 'e', 'e'],
        ['f', 'f', 'f'],
        ['g', 'g', 'g'],
        ['h', 'h', 'h'],
        ['i', 'i', 'i']]], dtype='<U21')
数组(['1',1',1'],
['2', '2', '2'],
['3', '3', '3'],
['4', '4', '4'],
['5', '5', '5'],
['6', '6', '6'],
['7', '7', '7'],
['8', '8', '8'],
['9', '9', '9']],
[a',a',a'],
['b','b','b'],
[c',c',c'],
['d','d','d'],
['e','e','e'],
[f',f',f'],
[g',g',g'],
['h','h','h'],

['i','i','i']],dtype='
hstack
is
concatenate(args,axis=1)
array([[['1', '1', '1'],
        ['2', '2', '2'],
        ['3', '3', '3'],
        ['4', '4', '4'],
        ['5', '5', '5'],
        ['6', '6', '6'],
        ['7', '7', '7'],
        ['8', '8', '8'],
        ['9', '9', '9']],

       [['a', 'a', 'a'],
        ['b', 'b', 'b'],
        ['c', 'c', 'c'],
        ['d', 'd', 'd'],
        ['e', 'e', 'e'],
        ['f', 'f', 'f'],
        ['g', 'g', 'g'],
        ['h', 'h', 'h'],
        ['i', 'i', 'i']]], dtype='<U21')