I am trying to do something really simple.
I have a numpy array and if any values in the array are 255 I want to
change them to 1.
but I can't seem to get anything to work!
If I use:
for i, value in enumerate(mask_arr):
if value==255:
mask_arr[i]=1
I get this error:
Traceback (most recent call last):
File "d:/timeseries_mask.py", line 51, in <module>
if value==255:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
and if I try to add a.any() to my code:
for i, value in enumerate(mask_arr):
if value.any()==255:
mask_arr[i]=1
my array does not change at all.
Any feedback will be greatly appreciated
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor