How do I build a custom function to apply to df.rolling().apply(func) that gets the first or last row in the rolling window period and do something with it?
df.rolling().apply(func)