I'm having trouble editing values ββin a numpy array
import numpy as np foo = np.ones(10,10,2) foo[row_criteria, col_criteria, 0] += 5 foo[row_criteria,:,0][:,col_criteria] += 5
row_criteria and col_criteria are logical arrays (1D). In the first case, I get
"form mismatch: objects cannot be transferred to one form" error
In the second case, + = 5 is not applied at all. When i do
foo[row_criteria,:,0][:,col_criteria] + 5
I get a modified return value, but changing the value in place does not work ...
Can someone explain how to fix this? Thanks!
source share