Created
January 17, 2020 23:13
-
-
Save BetterProgramming/5f180582f92f45c1cdbc610b8bc6ba4e 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
# 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