I am working with a pandas dataframe and performing the plots and tables as the following. Here is a sample of the data;
companyID,county,city,companytype,turnover_class,customertype,sni,emp_class,yearmonth,productcode,sales,month,day,weekday,year,subproduct 0,127,S ,180,81,11,B5,20150,14,2015-04-01,Övrigt,205940,4,1,Wednesday,2015,Kolhydrater 1,127,S ,180,81,11,B5,20150,14,2015-05-01,Övrigt,1088628,5,1,Friday,2015,Kolhydrater 2,127,S ,180,81,11,B5,20150,14,2015-06-01,Övrigt,264358,6,1,Monday,2015,Kolhydrater 3,127,S ,180,81,11,B5,20150,14,2015-06-01,Övrigt,521313,6,1,Monday,2015,Godis 4,127,S ,180,81,11,B5,20150,14,2015-06-01,Övrigt,795825,6,1,Monday,2015,Godis 5,127,S ,180,81,11,B5,20150,14,2015-07-01,Övrigt,107325,7,1,Wednesday,2015,Kolhydrater 6,127,S ,180,81,11,B5,20150,14,2015-07-01,Övrigt,576303,7,1,Wednesday,2015,Godis 7,127,S ,180,81,11,B5,20150,14,2015-08-01,Övrigt,1137793,8,1,Saturday,2015,Kolhydrater 8,127,S ,180,81,11,B5,20150,14,2015-08-01,Övrigt,13308,8,1,Saturday,2015,Godis 9,127,S ,180,81,11,B5,20150,14,2015-08-01,Övrigt,80975,8,1,Saturday,2015,Godis 10,127,S ,180,81,11,B5,20150,14,2015-09-01,Övrigt,662355,9,1,Tuesday,2015,Godis
sns.lineplot(data=df_replace_code3,x='subproduct',y='sales',hue='productcode',markers=True,style='productcode',dashes=False)
product_sales = pd.pivot_table(data=df_replace_code3, index=['productcode', 'subproduct'], values='sales',
aggfunc='sum').reset_index().sort_values(['productcode', 'sales'], ascending=False)
product_sales
and
from pickle import TRUE
plt.rcParams['figure.figsize'] = (15,22)
ax = plt.axes()
ax.set_facecolor('#2F2F2F')
sns.barplot(y='subproduct', x='sales', data=df_replace_code3, hue='productcode')
bbox_args = dict(boxstyle = 'round', fc = '1')
for p in ax.patches:
width = p.get_width()
plt.text(p.get_width(), p.get_y() + 0.5 * p.get_height(), '{:1.0f}'.format(width),
ha = 'center',
va = 'center',
color = 'black',
bbox = bbox_args,
fontsize = 13)
plt.title('Sales by product & sub product', fontsize = 18)
plt.ylabel(None)
plt.tick_params(left=False, bottom=False, labelbottom=False)
plt.show()
My question is that how interpret the plots and why the numbers in table is different with the numbers in barplot and lineplot?