https://prefect.io logo
Title
c

Crawford Collins

06/02/2020, 11:40 PM
Hi I'm trying to do a lot of work with mapped functions. How do i merge the results of 2 tasks together? For example
imputed_categorical_dfs
returns two objects. I need to merge these with another task which does the same.
My code which does not work.
transformed_df_map = merge_transformed_data.map(
        df1=[*imputed_categorical_dfs, *encoded_df_map],
        df2=[*imputed_numeric_dfs] + [*yeo_johnson_dfs],
    )
z

Zachary Hughes

06/03/2020, 12:08 AM
Hi @Crawford Collins! You should be able to merge the results of two tasks with another task, like in the link below. Does an approach like this seem like it might work for you? If not, happy to dig deeper if you can provide some pseudocode. https://docs.prefect.io/core/concepts/mapping.html#prefect-approach
c

Crawford Collins

06/03/2020, 1:14 AM
Thanks, I figured it out. Never needed to unpack anything.:
transformed_df_map = merge_transformed_data.map(
        df1=imputed_categorical_dfs + encoded_df_map,
        df2=imputed_numeric_dfs + yeo_johnson_dfs
    )
👍 1
z

Zachary Hughes

06/03/2020, 1:36 AM
Glad to hear it!