小编Rag*_* MG的帖子

将列添加到二维列表

我有一个二维数组列表,例如

  array( [ 988,  389],
         [ 986,  389],
         [ 985,  388],
         [ 977,  388],
         [ 976,  387]], dtype=int32)
Run Code Online (Sandbox Code Playgroud)

和另一个列表

 array( [ 149.68299837],
        [ 149.25481567],
        [ 150.029997  ],
        [ 148.63714206],
        [ 149.48244044]])
Run Code Online (Sandbox Code Playgroud)

我尝试使用连接这两个列表

  trail = list(map(list,zip(two_d_array,concat)))
  trail = np.vstack(trail)
Run Code Online (Sandbox Code Playgroud)

这给了我

  array([array([988, 389], dtype=int32), array([ 149.68299837])],
        [array([986, 389], dtype=int32), array([ 149.25481567])],
        [array([985, 388], dtype=int32), array([ 150.029997])],
        [array([977, 388], dtype=int32), array([ 148.63714206])],
        [array([976, 387], dtype=int32), array([ 149.48244044])]], dtype=object)
Run Code Online (Sandbox Code Playgroud)

如何删除所有数组和数据类型并仅显示数字,例如

     [ 988,  389,149.68299837],
     [ 986,  389,149.25481567],
     [ 985,  388, 150.029997],
     [ 977,  388,148.63714206],
     [ …
Run Code Online (Sandbox Code Playgroud)

python numpy concatenation python-3.x

2
推荐指数
1
解决办法
3345
查看次数

标签 统计

concatenation ×1

numpy ×1

python ×1

python-3.x ×1