0

I have function to plot column from a data frame as below. How do I define Labels for the plot so that everytime I call this function, "COLUMN_NAME" will be the column of dataframe.

def plotting(df,column):
    x_15 = pd.DataFrame({'COUNT':[len(df),df[column].sum()], 'LABEL':['TOTAL RECORDS','COLUMN_NAME']})
    plt.figure(figsize=(4,6))
    sns.set_style("whitegrid")
    plt.title('NO. OF RECORDS FOR "COLUMN NAME"')
    ax = sns.barplot(x="LABEL",y="COUNT", data=x_15)
    ssa.annotate(ax, message = 'Count',location='Middle', fontsize = 15)
    plt.show()
Hackerds
  • 1,195
  • 2
  • 16
  • 34

0 Answers0