You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 24, 2022. It is now read-only.
using ShiftedArrays
hcat(dayahead, select(by(dayahead, :node, load_lag1 =:load=> lag), Not(:node)))
The key part is this: by(dayahead, :node, load_lag1 = :load => lag) but I haven't been able to figure out a way to insert additional columns into that statement. The Not(:node) part is included since it is assumed that the order of the results are the same as the original dataframe, and we can't just join the results on the node column since the time column is relevant too, but not outputted by the by statement.
generic function:
function lag_df(df::DataFrame, groupcol::Symbol, valuecol::Symbol)
return hcat(df, select(by(df, groupcol, lag1 = valuecol => lag), Not(groupcol)))
end
lag_df(dayahead, :node, :load)
The text was updated successfully, but these errors were encountered:
(For my reference this was feature number 11 on initial list)
@cbdavis proposes alternative:
The text was updated successfully, but these errors were encountered: