【发布时间】:2023-03-11 21:13:01
【问题描述】:
copyto = zeros(10)
what = ones(3)
where = 2
copyto[where:len(what)+where] = what
有没有办法将较小数组中的所有值复制到特定位置的较大数组中,而不提供上索引?我认为它会起作用的方式是
copyto[where:] = what
但这给了我
ValueError: operands could not be broadcast together with shapes
谢谢!
【问题讨论】:
标签: arrays numpy replace indexing copy