numpy.place()

numpy.place

numpy.place(arr, mask, vals) [source]

Change elements of an array based on conditional and input values.

Similar to np.copyto(arr, vals, where=mask), the difference is that place uses the first N elements of vals, where N is the number of True values in mask, while copyto uses the elements where mask is True.

Note that 登录查看完整内容