Sep-02-2023, 10:14 PM
(This post was last modified: Sep-02-2023, 10:14 PM by deanhystad.)
That is an odd thing to do, and I strongly advise against it. Functions should only care about the values passed, not about the name of some variable that once referenced the value. That is why you could find no information about it.
If you want your dataframes to have a name, give them a name.
Personally, I don't think you should name the file. I would pop up a dialog asking for the user to select/enter a filename, and a file type.
If you want your dataframes to have a name, give them a name.
df = pandas.DataFrame(...) df.name = "some name I want associated with this dataframe"Your "time_plot_a" dataframe might be reference by several variables at different times during its lifetime. Which one should give it a name? You are saying the only important variable is the one that was used to call the function that saves a plot? Making a plot and saving the plot to a file sounds like a useful thing. Something I would want to use over and over. By naming the file after the variable used to reference the dataframe in the function call you have placed severe restrictions on how this function can be used.
Personally, I don't think you should name the file. I would pop up a dialog asking for the user to select/enter a filename, and a file type.