Mar-29-2019, 03:18 AM
Are you telling about applying a rolling window of variable width? If so, Pandas doesn't support such windows, except ones based on datetime-like columns. You can try to 1) write all logic in a for loop, e.g. using
df.iterrows()
; 2) Use Cython, df.values
is numpy array, Cython supports numpy arrays; (that would be most efficient) 3) make some magic and turn you condition on selecting window size into datetime-like column and apply pandas rolling window (I am not sure if this possible);