This message was deleted.
# general
s
This message was deleted.
👀 1
welcome 1
e
Hey! Welcome. So, if I understand you correctly, I think we support that. Two thoughts: 1. We’re making improvements to `@parameterize_inputs`/the works that can help: https://github.com/stitchfix/hamilton/issues/162. This will make it easier to express it. 2. At Stitch Fix we’ve used constants to solve this problem — effectively storing a list of these external to the function. Something like the following.
Copy code
COLS_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?
b
Ah ok, using constants like that would work for initial calculations at least. Downstream stuff seems doable just by constructing different strings for col names. I think in my head it seems cleaner if there would be some way to define the function and then use it as a modifier for a list of series somehow... something like
Copy code
@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.
e
Nice! And yeah, I think that’s pretty feasible. Re: that, it is doable if I get what you’re going for — we have a decorator called
@does
— its slightly limited, but should do the trick: https://github.com/stitchfix/hamilton/blob/90afd3a08df15794f95f9741510923d089a6946a/decorators.md#does.
Let me know if you want to hop on a call at some point and I’m happy to walk you through some of these
⬆️ 1
b
Thanks! I'll give it a try and follow up if I can't get very far.
👍 1
s
@Ben Yeah we’d love to make you successful in using Hamilton, so any feedback good/bad will be valuable to us 🙂
e
Hey @Ben -- new
rc
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