Use vectorised functions instead of the loops
My function is such that it takes the minimum over the range of dataframe which keeps increasing in length and maximum over the dataframe which reduces in length with each iteration.
My function is such that it takes the minimum over the range of dataframe which keeps increasing in length and maximum over the dataframe which reduces in length with each iteration.