How to merge 2 numpy arrays?

后端 未结 3 559
轮回少年
轮回少年 2021-01-25 09:02

I feel like there is some documentation I am missing, but I can\'t find anything on this specific example - everything is just about concatenating or stacking arrays.

I

3条回答
  •  面向向阳花
    2021-01-25 09:36

    In [39]: z = np.concatenate((x[...,None], y[...,None]), axis=2)
    
    In [40]: z
    Out[40]: 
    array([[[ 1,  7],
            [ 2,  8],
            [ 3,  9]],
    
           [[ 4, 10],
            [ 5, 11],
            [ 6, 12]]])
    

提交回复
热议问题