I\'m new to NumPy, and I\'ve encountered a problem with running some conditional statements on numpy arrays. Let\'s say I have 3 numpy arrays that look like this:
A slight change in the numpy expression would get the desired results:
c += ((a > 3) & (b > 8)) * b*2
Here First I create a mask matrix with boolean values, from ((a > 3) & (b > 8)), then multiply the matrix with b*2 which in turn generates a 3x4 matrix which can be easily added to c