Lag/lead in panel data

I haven’t tried this personally, but you should be able to do a combine where you make your sub-dataframes a TimeArray, perform operations on them, then at the end it becomes a data frame again.

combine(groupby(df, :id)) do sdf
    TA = TimeArray(sdf, timestamp = :date)
    ### operations
    DataFrame(TA)
end