Slackbot
08/10/2022, 9:46 PMElijah Ben Izzy
08/10/2022, 9:53 PMCOLS_FOR_QUARTERLY_CHANGES = ['foo', 'bar', 'baz', ...]
# you can reuse these as much as you want
@parameterize_inputs(
**{key + '_quarterly_rate' : {'col' : key} for key in COLS_FOR_QUARTERLY_CHANGES})
def compute_quarterly_rate(col: pd.Series) -> pd.Series:
# some math here
Curious though, how do you want to combine them/use them downstream?Ben
08/10/2022, 10:06 PM@modifier
def yoy(pd.Series) -> pd.Series:
# get year over year change
@parameterize_inputs(yoy(MY_COLS_CONST))
def greatest_change_reducer(pd.Series) -> pd.Series:
# math
...but I'm not actually sure how well that would work in practice.Elijah Ben Izzy
08/10/2022, 10:09 PM@does
— its slightly limited, but should do the trick: https://github.com/stitchfix/hamilton/blob/90afd3a08df15794f95f9741510923d089a6946a/decorators.md#does.Elijah Ben Izzy
08/10/2022, 10:09 PMBen
08/11/2022, 12:30 AMStefan Krawczyk
08/11/2022, 12:32 AMElijah Ben Izzy
08/16/2022, 3:41 AMrc
version with some fixes to parmaeterize -- let me know if it helps what you're working on! https://hamilton-opensource.slack.com/archives/C03M34FM058/p1660621246625529