Created
January 12, 2021 19:46
-
-
Save bh1995/ad57d090800ed3f3f961970b389b6665 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 nr neighbourhoods for top 30 cities | |
neighbourhood_list = listing_total.sort("total_neighbourhood", ascending=False) | |
neighbourhood_list_pd = neighbourhood_list.toPandas() # convert to pandas dataframe | |
list_neighbourhood_30 = neighbourhood_list_pd.iloc[1:31]; | |
num = len(list_neighbourhood_30)*4 | |
c = [i for i in range(0,num,4)] | |
plt.figure(figsize=(10,4)) | |
plt.bar(c, list_neighbourhood_30['total_neighbourhood'],width=3, align='center', alpha=0.5) | |
plt.xticks(c,list_neighbourhood_30['city'],rotation=90) | |
plt.ylabel('total neighbourhood') | |
plt.xlabel('city') | |
plt.title('The total neighbourhood in top 30 cities') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment