I have an array (3 by 3) and need to output the same size array in which each value is divided by the cumulative sum over the row.
A = np.array([ [1,4,1], [4,1,9], [1,9,1]])
ideal_output = [[1/6, 4/6, 1/6], [4/14, 1/14, 9/14], [1/11, 9/11, 1/11]]
Current Code but this is outputting with wrong dimensions:
output = []
denom = 0
for i in A:
value_sum = np.cumsum(i)
denom += value_sum
for i in A:
result= i / denom
output.append(result)