Pass all the elements of dictionary together to a function – Python

I have a function which takes dataframes and unions all of the input dataframe.

Currently I have all the dataframe stored in a dictionary. for ex:

my_dict = { ‘df_1’: ‘first DataFrame Object’, ‘df_2’: ‘second DataFrame object’}

How do I pass all the elements of dictionary together dynamically to below function? I need to pass like

unionAll(my_dict['df_1'],my_dict['df_2']) # how to generate this dnamically, given number of elements in dictionary would change in each run
#Function Definition:

def unionAll(*dfs):
    return reduce(DataFrame.unionAll, dfs)

Answer

No need to access per key, just access the values directly. Since you are accepting it as a variable amount of arguments *dfs, then you have to unwrap it first via *values before passing.

unionAll(*my_dict.values())