I have an array with dimensions (10x10) and i want to create another one (10x10). Lets say the first one is called A and the second one B. I want B to have 0 value if the value of A is zero respectively or another value(specified by me) lets say c if the value of A is not zero.
something like that
B[i] = A[i] == 0 ? 0 : c
Can this be done automatically by numpy?Like this:
B = A == 0 ? 0:c
or must i traverse the arrays element by element?
Editing for more info:
I have a numpy Array(10x10) A and one B same dimensions. I created another one
dif = A-B
now A has zero elements and B two, ergo dif has some zero elements
I want to create another one C numpy array where if A has element zero the value in C will be zero but if not then the value would be dif/A (the division of the elements)