I have a data frame with column A and B. Desired outcome: If cumsum of B reaches value >=15, following operations for the rows between 0 and cumsum >=15 shall be computed: df["Amean"] =df["A"].mean() and df["Bsum15"] = df["B"].sum() ; then cumsum shall be reset to 0 again and the loop continues.
similar topic:
Python pandas cumsum() reset after hitting max