小编the*_*ood的帖子

如何将小型2D阵列添加到更大的阵列?

我有一个更大的2D数组,我想添加一个更小的2D数组.

from numpy import *
x = range(25)
x = reshape(x,(5,5))
print x
[[ 0  1  2  3  4]
 [ 5  6  7  8  9]
 [10 11 12 13 14]
 [15 16 17 18 19]
 [20 21 22 23 24]]
y = [66,66,66,66]
y = reshape(y,(2,2))
print y
[[66 66]
 [66 66]]
Run Code Online (Sandbox Code Playgroud)

我想将数组中的值添加yx起始位置1,1,x如下所示:

[[ 0  1  2  3  4]
 [ 5 72 73  8  9]
 [10 77 78 13 14]
 [15 16 …
Run Code Online (Sandbox Code Playgroud)

python arrays numpy slice

4
推荐指数
2
解决办法
2367
查看次数

标签 统计

arrays ×1

numpy ×1

python ×1

slice ×1