Created
January 12, 2021 20:59
-
-
Save bh1995/38ca6f43ea6dcb7a51b22c866cc51a55 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_sql = """SELECT a.date, b.city,b.neighbourhood_cleansed | |
FROM reviews_df a | |
LEFT JOIN listings_df2 b | |
on a.listing_id = b.id | |
WHERE b.city='Beijing' | |
ORDER BY date ASC; | |
""" | |
beijing_popularity = spark.sql(beijing_popularity_sql).cache() | |
beijing_popularity_pd = beijing_popularity.toPandas() | |
# plot | |
plt.figure(figsize = [16,7])# set figuresize | |
plt.hist(beijing_popularity_pd['date'],bins = 50,alpha = 0.5,color = 'red',edgecolor = 'white', linewidth = 1.2) | |
plt.xlabel('Date',size = 15) | |
plt.ylabel("Popularity",size = 15) | |
plt.title("Histogram of Bei Jing popularity(reviews) Change",size = 15) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment