I need to compare each element in a 3d array a
to a 2d array b
and change values in a
if they exceed values in b
.
a.shape = 4000,5,5
b.shape = 5,5
This gives me the correct result when comparing all elements in a
to b
:
a[a[:,:,:]>=b]=1
a[a[:,:,:]<b]=0
However, I need to perform this as part of a loop and on slices of a
. In the loop I will pass (start:end) values for example:
a[a[10:25,:,:]>=b]=1
a[a[10:25,:,:]<b]=0
This raises the error:
VisibleDeprecationWarning: boolean index did not match indexed
array along dimension 0; dimension is 4000 but corresponding
boolean dimension is 15 if __name__ == '__main__':
The result is correct for what I need but is there, or what is, the way to do this without raising an error?
Thank you