Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#dictionary for meals per food item
item_count = {}
for i in range(table.index.nunique()):
item_count[table.index[i]] = table.num_orders[i]/df_meal[df_meal['category']==table.index[i]].shape[0]
#bar plot[x for x in item_count.keys()],[x for x in item_count.values()],color='orange')
#adjust xticks
#label x-axis
plt.xlabel('Food item')
#label y-axis
plt.ylabel('No. of meals')
#label the plot
plt.title('Meals per food item')
#save plot
plt.savefig('C:\\Users\\Dell\\Desktop\\AV Plotting images\\matplotlib_plotting_7.png',dpi=300,bbox_inches='tight')
#display plot;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment