0

I have a function used by at least 1000 dataframes and I want to know each time this function is called, which df has passed to this function,

def multi_purp_df(df):
    print(f'Name of df passed is: {df.name}')
    return 

I know one way is to set df.name = df_client before calling the function but this means setting the name 1000 times in different places! Is there any way to do this inside the function automatically? For example, with multi_purp_df(df_client), I like to print df_client

Phoenix
  • 359
  • 7
  • 15
  • 1
    Does this answer your question? [How can you print a variable name in python?](https://stackoverflow.com/questions/592746/how-can-you-print-a-variable-name-in-python) – Ynjxsjmh May 16 '22 at 14:17
  • 2
    Use a dictionary to hold the dataframes, the keys will be the labels – mozway May 16 '22 at 14:26

0 Answers0