I want to get updated value of Pw at each iteration. For first iteration, it takes minimum value of first row and subtracts from Pw1. For second iteration, I want it to take this updated Pw (not Pw1) and subtract the minimum of second row.
import numpy as np
Pe=np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]])
Pw1=100
Pe_min=Pe.min(axis=1)
for i in range(4):
Pw=np.zeros(4)
Pw[i]=Pw1-Pe_min[i]
print(Pw)
The current output is
99
95
91
87
The output I am seeking is
99
94
85
72