I have a function which gets a data frame and one column and after some process, plot that column, as in the following line:
def plot_dist(df,col):
ax=sns.countplot(x=col,data=df)
As i repeat this function for several dataframes, I'd like to have the dataframe name in the title of the plot, like this: "Distribution of col in dataframe df"
plt.title('Distribution of '+ col + 'in dataframe' + df.name );
Q: how to get dataframe name? According to here, one can write df.name='DFNAME' and then get the string by df.name. But then one has to define the name and I am not sure if it works in the loop. Thank you!