Contruct 3d array in numpy from existing 2d array

前端 未结 3 755
终归单人心
终归单人心 2021-02-18 23:57

During preparing data for NumPy calculate. I am curious about way to construct:

myarray.shape => (2,18,18)

from:

d1.shape          


        
3条回答
  •  遥遥无期
    2021-02-19 00:33

    arr3=np.dstack([arr1, arr2])
    

    arr1, arr2 are 2d array shape (256,256), arr3: shape(256,256,2)

提交回复
热议问题