Skip to content

Instantly share code, notes, and snippets.

@srang992
Created October 18, 2022 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srang992/2d46ab965466defc317d451c504b5391 to your computer and use it in GitHub Desktop.
Save srang992/2d46ab965466defc317d451c504b5391 to your computer and use it in GitHub Desktop.
# selecting chain restaurants which have 'Italian', 'Mexican', and 'Chinese' cuisines.
italian_chain = chain_data[(chain_data['Cuisine']=='Italian') & (chain_data['Frequency'] > 5)]
mexican_chain = chain_data[(chain_data['Cuisine']=='Mexican') & (chain_data['Frequency'] > 5)]
chinese_chain = chain_data[(chain_data['Cuisine']=='Chinese') & (chain_data['Frequency'] > 5)]
# getting the name of the restaurants where those cuisines mostly available
italian_rest = count_df(italian_chain, 'RestaurantName').head(5)
mexican_rest = count_df(mexican_chain, 'RestaurantName').head(5)
chinese_rest = count_df(chinese_chain, 'RestaurantName').head(5)
# defining titles and colors
titles = ["Italian Restaurants", "Mexican Restaurants", "Chinese Restaurants"]
colors = ['#ff9999','#66b3ff','#99ff99','#ffcc99', '#f4bbff']
# plotting the donut charts
fig = multi_donut_charts([italian_rest, mexican_rest, chinese_rest], 1, 3,
['RestaurantName','RestaurantName', 'RestaurantName'], colors, titles,)
plt.tight_layout()
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment