Created
January 12, 2021 21:22
-
-
Save bh1995/96366643ce6546891b6da9dc4e832ed0 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
beijing_popularity_month = beijing_popularity.groupBy(f.month(beijing_popularity["date"]).alias("month")).count().sort("month", ascending=True) | |
beijing_popularity_month_pd = beijing_popularity_month.toPandas() | |
num = len(beijing_popularity_month_pd)*4 | |
c = [i for i in range(0,num,4)] | |
plt.figure(figsize=(10,4)) | |
plt.bar(c, beijing_popularity_month_pd['count'],width=3, align='center', alpha=0.5) | |
plt.xticks(c,beijing_popularity_month_pd["month"]) | |
plt.ylabel('Popularity') | |
plt.xlabel('Month') | |
plt.title('The Popularity of Beijing by month') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment