0

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.

5
  • a return statement doesn't display anything. Do you mean "return the content of all the dataframes"? Commented Dec 27, 2021 at 17:43
  • Yes, my apologies. Commented Dec 27, 2021 at 17:45
  • Edited your question to reflect that (you could have done that yourself!). Anyway, what's wrong with return (a_table, b_table, c_table)? Commented Dec 27, 2021 at 17:48
  • It just returns a list saying (<DataFrame object>, <DataFrame object>, <DataFrame object>), but I want the function to display what's in these respective dataframes simultaneously. Commented Dec 27, 2021 at 17:54
  • that's exactly what I asked when you said you didn't want to display... Commented Dec 27, 2021 at 18:00

2 Answers 2

1

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)
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.