I want to calculate the minimum value until cond column is true
Then recalculate the minimum value starting from the next row where the cond column is true
The obtained result is assigned to the expected column
input
import pandas as pd
import numpy as np
A=[16,12,21,15,18,19,13,16,10,50]
cond=[False,False,True,False,False,True,False,False,True,False]
df=pd.DataFrame({'A':A,'cond':cond})
df
the expected table
A cond expected
0 16 FALSE
1 12 FALSE
2 21 TRUE 12
3 15 FALSE 12
4 18 FALSE 12
5 19 TRUE 15
6 13 FALSE 15
7 16 FALSE 15
8 10 TRUE 10
9 50 FALSE 10
Index 5 calculates the minimum value from index 3 to index 5
Index 8 calculates the minimum value from index 6 to index 8