Suppose I have an array a=[1.8 1.2 2.2 1.6]
. I want to write a code so that I can get the smallest value till the values in the array are exhausted.
The desired output at the first step:
1.2
This value is then assigned to int_SOC
and acts as an input for a while loop below:
fin_SOC = 3.2
i=0
while True:
if int_SOC < fin_SOC:
int_SOC += output_params.iloc[i, 3]
else:
break
i+=1
print(int_SOC)
Only at the end of this while loop int_SOC
should get the next smallest value that is in our case 1.6
.
Here, output_params
is a pandas time-series data frame.
As the next step, we are left with an array a=[1.8 2.2 1.6]
. Now the desired output: 1.6
which is again assigned to int_SOC
and while
loop is again executed.
And so on...