Skip to content

Instantly share code, notes, and snippets.

@gbarreiro
Created September 20, 2020 14:54
Show Gist options
  • Save gbarreiro/8ce7f1e0833c76e9394edccbfbc9d018 to your computer and use it in GitHub Desktop.
Save gbarreiro/8ce7f1e0833c76e9394edccbfbc9d018 to your computer and use it in GitHub Desktop.
Best cuisines: insight 3
percentages = {}
for city, cuisine in city_local_cuisines.items():
# For each city, get the percentage of local cuisine restaurants
percentage = cuisines_city_normalized.at[city, cuisine]
percentages[city] = percentage
# Plot the data in a bar graph
df_percentages = pd.Series(percentages).sort_values(ascending=True)
df_percentages.plot(kind='barh')
plt.xlabel('% of local cuisine restaurants')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment