Concatenate 3d Numpy Arrays By Row
I have the following 2 3D numpy arrays that I want to concatenate. The arrays look like this: a = np.array([[[1,1,1],                 [2,2,2],                 [3,3,3]],
Solution 1:
Use np.hstack:
np.hstack([a, b])
Output:
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')
Post a Comment for "Concatenate 3d Numpy Arrays By Row"