Skip to content

Instantly share code, notes, and snippets.

@bh1995
Created January 12, 2021 19:26
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 bh1995/a72440f5b0df9061e49319c2aee09541 to your computer and use it in GitHub Desktop.
Save bh1995/a72440f5b0df9061e49319c2aee09541 to your computer and use it in GitHub Desktop.
# Plot nr listings for top 30 cities
list_small = listing_total.limit(30).toPandas() # Convert to pandas dataframe
num = len(list_small)*4
c = [i for i in range(0,num,4)]
plt.figure(figsize=(10,4))
plt.bar(c, list_small['total_listing'],width=3, align='center', alpha=0.5)
plt.xticks(c,list_small['city'],rotation=90)
plt.ylabel('total listing')
plt.xlabel('city')
plt.title('The total listings in top 30 cities')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment