我正在尝试将数组中的条件值插入到空数组的确切位置。
empty_array = np.zeros([40,100])
for x in range (1,24):
array[x,:,:] #which is also sized 40x100
if the_values_in_the_array < 0.25:
the_values_in_the_array = 0
empty_array = empty_array + array [x,:,:]
我应该为这个逻辑使用哪种语法?我应该如何扫描 the_values_in_the_array 以找到条件值?
最佳答案
empty_array = np.zeros([40,100])
array = np.random.rand(24,40,100)
array[array<0.25]=0 # change all the values which is <0.25 to 0
for x in range(1,24):
empty_array += array[x,:,:]
关于python - 在数组中查找特定值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37834397/