Using `numpy.where` to alter slices instead of elements of multidimensional arrays?

后端 未结 0 1075
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-07 13:16

Using numpy.where to alter elements of an array is easy enough

import numpy as np
x = np.array([[5, 5], [2, 3]])
x[np.where(x > 4)] = 0

相关标签:
回答
  • 消灭零回复
提交回复
热议问题