Prasanta Midya
12/28/2024, 10:27 AMElijah Ben Izzy
12/28/2024, 6:00 PMdef _foo_helper(df):
...
def foo(df: pd.DataFrame) -> pd.DataFrame:
return _foo_helper(df)
def bar(foo: pd.DataFrame) -> pd.DataFrame:
...
def foo_again(bar: pd.DataFrame) -> pd.DataFrame:
return _foo_helper(df)
Group together
• as you would without Hamilton, just a bigger hamilton node
• less visibility
def transformed_df(df: pd.DtaFrame) -> pd.DataFrame:
df = _foo_helper(df)
...
df = _foo_helper(df)
return df
pipe_output
• Nice way to chain transforms
• Full visibility into the application
• Uses a more complex construct
@pipe_output(
step(_foo_helper),
step(_bar), # define elsewhere
step(_foo_helper), # run aagin
...
)
def df():
... # return some dataframe
There are a few other approaches as well but I think the ones above are nice and simpleStefan Krawczyk
12/28/2024, 11:32 PM