Overhaul augment_rolling to streamline window function handling #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposing an overhaul of the augment functions to be able to handle all variety of window function types in one call.
window_func
andwindow_func_with_iv
to cleanly separate Series-based and DataFrame-based rolling functions.use_independent_variables
argument, enhancing function flexibility.Example of the type of call that would be possible:
The problem addressed:
Functions relying on a series (a value column) cycle through each value column in a list.
Functions relying on a dataframe (independent variables) get repeatedly called and duplicated in the dataframe if there is > 1 value listed in the value column.
Also gets a little messy with lambda functions depending on if you have them operating on a series or data frame.
lambda x: func(x)
-- vs ---lambda x: func(x[specific_col])
Passing multiple lambda functions of different forms can cause problems.
Users wanting a mix of various types of window function calls would need run the multiple augment calls and concatenate resulting dataframes to get one dataframe with all desired features.