Hello there, What's the best practice to collect ...
# hamilton-help
h
Hello there, What's the best practice to collect a bunch of pd.Series to construct a pandas dataframe, shall I explicitly specify the input pd.Series nodes in the parameter list and use contact to collect them, can I use instead **kwargs?
s
You will need to pass all the nodes you want in as arguments to the DataFrame constructing node. But you can use locals from there to construct the DataFrame.
Copy code
def dataset(
 feature_a: pd.Series,
 feature_b: pd.Series,
 feature_c: pd.Series,
) -> pd.DataFrame:
 return pd.DataFrame(locals())
This a simple approach, @Stefan Krawczyk would be better to advise on something more dynamic if this doesn’t cover it
🙌 1
🙏 1
s
@Hassan S does that did your use case? There's other ways as @Seth Stokes said with respect to dynamism.
🙏 1