Guest User

Untitled

a guest
Sep 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. def myfunc(rolling_window) :
  2. count=0
  3. n=len(rolling_window)
  4. if rolling_window[-1]!=0 :
  5. return 0
  6. else :
  7. for i in range(0,n) :
  8. if rolling_window[n-i-1] ==0 :
  9. count=count + 1
  10. else :
  11. break
  12. return count
  13. df2['zerocum']=df2.groupby(['customerParentID','forecastGroup'])['demandQuantity'].shift(6).rolling(window=36,min_periods=1).apply(myfunc)
  14.  
  15. df2['zerocum']=df2.['demandQuantity'].shift(6).rolling(window=36,min_periods=1).apply(myfunc)
Add Comment
Please, Sign In to add comment