The results of executing a dataflow is returning o...
# hamilton-help
e
The results of executing a dataflow is returning one of my dataframes in the dataset keyed in the results of the driver as 'function_name.column1', 'function_name.columns2' etc. I expect the dataframe to be in the results as simply 'function_name'. When I manually execute the function, I do in fact retrieve a single dataframe. The first screenshot shows the expected results of the function which is a single dataframe with the columns in tact. The second screenshot shows the dataframe has been broken out in the results and each column is now a series. Any ideas on what I'm doing wrong?
normalizing the index
Copy code
def spy_data_date_normalized(
    spy_data: pd.DataFrame, common_dates: pd.DatetimeIndex
) -> pd.DataFrame:
    """Filter SPY data to common dates."""
    return spy_data.reindex(common_dates)
s
No that's expected behavior. We flatten any dataframes returned by default. You can change this by customizing
I'm on my phone, but look up custom result builders, or using the dict result that is default if you use the Builder() to construct the driver
🙌 1
e
That was it. I misunderstood how Hamilton worked. I need to use a DictResult adaptor to get what I am looking for. Thanks for pointing me in that direction!
👍 1
t
Alternatively, look into using a
Builder()
to create a
Driver
doesn't flatten series by default
👍 1