This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_center = pd.read_csv('C:\\Users\Dell\\Desktop\\train_food\\fulfilment_center_info.csv') | |
df_center.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
plt.style.use('seaborn') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_meal = pd.read_csv('C:\\Users\Dell\\Desktop\\train_food\\meal_info.csv') | |
df_meal.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_center = pd.read_csv('C:\\Users\Dell\\Desktop\\train_food\\fulfilment_center_info.csv') | |
df_center.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_food = pd.read_csv('C:\\Users\Dell\\Desktop\\train_food\\train_food.csv') | |
df_food.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.merge(df_food,df_center,on='center_id') | |
df = pd.merge(df,df_meal,on='meal_id') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table = pd.pivot_table(data=df,index='category',values='num_orders',aggfunc=np.sum) | |
table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#bar graph | |
plt.bar(table.index,table['num_orders']) | |
#xticks | |
plt.xticks(rotation=70) | |
#x-axis labels | |
plt.xlabel('Food item') | |
#y-axis labels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
plt.bar([x for x in item_count.keys()],[x for x in item_count.values()],color='orange') | |
#adjust xticks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#dictionary for cuisine and its total orders | |
d_cuisine = {} | |
#total number of order | |
total = df['num_orders'].sum() | |
#find ratio of orders per cuisine | |
for i in range(df['cuisine'].nunique()): | |
#cuisine |