2021年1月27日星期三

Pandas - Cumsum, skip row if condition based on the resulting accumulated value

How to accumulate values skipping rows if the accumulated result of those rows exceeds a certain threshold?

threshold = 120  Col1  ---  100  5  90  5  8    Expected output:  Acumm_with_condition  ---  100  105     (100+5)  NaN     (105+90 > threshold, skip )  110     (105+5)  118     (110+8)  
https://stackoverflow.com/questions/65929187/pandas-cumsum-skip-row-if-condition-based-on-the-resulting-accumulated-value January 28, 2021 at 08:01AM

没有评论:

发表评论