This message was deleted.
# hamilton-help
s
This message was deleted.
s
Homework question? are you confused about the code, or how Hamilton fits into the picture?
j
Not homework! Just trying to understand the best way to approach the issue assuming I was using Hamilton. I ended up using something like this:
Copy code
def _nest_series(**series:pd.Series) -> pd.Series:
    df = pd.DataFrame(series)
    return df.apply(pd.Series.to_dict, axis=1)
Reason I needed to do this is because saving 'nested' data structures from Pandas into GCP is supported by the google cloud libraries
s
Oh yep. You're missing returning
df
in the
_nest_series
function. But yeah that's one way to do it. I was asking in relation to Hamilton because you'd need to name the function arguments rather than them being in **kwargs.
e
(homework would be OK btw 🙂 )
s
@James Marvin e.g. :
Copy code
def my_dataframe(col_a: pd.Series, col_b: pd.Series) -> pd.DataFrame:
    return pd.DataFrame({'col_a': col_a, 'col_b': col_b})
👍 1