Home > Enterprise >  Returning multiple dataframes with Python
Returning multiple dataframes with Python

Time:12-28

So I want to write a function that looks something like this:

def return_all_tables(parameter):
    a_table = a(parameter)
    b_table = b(parameter)
    c_table = c(parameter)
    ...

Here, a, b and c are all different functions returning the dataframes a_table, b_table and c_table respectively.

What I'm not sure now is how to write the return statement to make it return the content of every dataframe.

CodePudding user response:

You would want something like this

def return_all_tables(parameter):
    a_table = a(parameter)
    b_table = b(parameter)
    c_table = c(parameter)
    return a_table, b_table, c_table

a, b, c = return_all_tables(parameter)
display(a, b, c)

CodePudding user response:

return a_table, b_table, c_table will return a 3-tuple containing the dataframes.

  • Related