James Marvin
06/30/2022, 11:11 AMStefan Krawczyk
06/30/2022, 2:50 PMJames Marvin
06/30/2022, 3:13 PMdef _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 librariesStefan Krawczyk
06/30/2022, 3:26 PMdf
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.Elijah Ben Izzy
06/30/2022, 4:34 PMStefan Krawczyk
06/30/2022, 6:29 PMdef my_dataframe(col_a: pd.Series, col_b: pd.Series) -> pd.DataFrame:
return pd.DataFrame({'col_a': col_a, 'col_b': col_b})