Created
March 12, 2020 17:35
-
-
Save aniruddha27/1d976786d57e9357214730bb1167975f to your computer and use it in GitHub Desktop.
This file contains 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 | |
c = df['cuisine'].unique()[i] | |
#num of orders for the cuisine | |
c_order = df[df['cuisine']==c]['num_orders'].sum() | |
d_cuisine[c] = c_order/total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment