With this function:
def df_printer(*args):
print(#DATAFRAME NAMED BALANCES#)
and 3 dataframes passed to the function:
df_printer(users, orders, balances)
Is there any way to reference these dataframes other than it's position? Can I reference them by name somehow? In this case, the balances df.
CodePudding user response:
If you use **kwargs
you can have a variable amount of keyword arguments accessible as a dictionary:
def df_printer(**kwargs):
print(kwargs["balances"])
df_printer(users=users, orders=orders, balances=balances)