Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created January 17, 2020 23:13
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 BetterProgramming/5f180582f92f45c1cdbc610b8bc6ba4e to your computer and use it in GitHub Desktop.
Save BetterProgramming/5f180582f92f45c1cdbc610b8bc6ba4e to your computer and use it in GitHub Desktop.
# Plot location_types
df = pd.DataFrame.from_dict(r['location_types'], orient='index')
df.index.name = 'location'
df.reset_index(inplace=True)
df.rename(columns={0: 'val'}, inplace=True)
# Remove the row with point_of_interest and establishment location
df = df[(df.location != 'point_of_interest') & (df.location != 'establishment')]
plt.figure(figsize=(16, 11))
sns.barplot(x="location", y="val", data=df, order=df.sort_values(
'val', ascending=False)['location']).set_title('Location types from {}'.format(location))
plt.xticks(rotation=45)
plt.subplots_adjust(bottom=0.15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment